brew下载的mysql卸载_【已解决】Mac中如何彻底卸载之前通过dmg安装的mysql

本文介绍如何在Mac上彻底卸载通过DMG文件安装的MySQL,包括删除安装目录、清理相关配置文件及历史记录等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

折腾:

期间,需要去彻底卸载掉,mac中之前通过dmg安装的mysql

mac uninstall mysql dmg➜  ~ ps -ax | grep mysql

28394 ??         0:00.03 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/promote.cache-dns.local.pid

28479 ??         0:09.33 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=promote.cache-dns.local.err --pid-file=/usr/local/mysql/data/promote.cache-dns.local.pid

66035 ttys013    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn mysql

➜  ~ kill -9 28394

kill: kill 28394 failed: operation not permitted

➜  ~ sudo kill -9 28394

Password:

➜  ~ sudo kill -9 28479

➜  ~ ps -ax | grep mysql

66087 ttys013    0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn mysql

➜  ~

知道此处不是brew安装的mysql,也去:➜  ~ brew remove mysql

Error: No such keg: /usr/local/Cellar/mysql

➜  ~ brew cleanup

Removing: /usr/local/Cellar/lame/3.99.5... (27 files, 2MB)

Removing: /usr/local/Cellar/pkg-config/0.29.1... (10 files, 627.3KB)

Removing: /usr/local/Cellar/wget/1.17.1... (9 files, 1.5MB)

Removing: /usr/local/Cellar/ffmpeg/3.3.4... (243 files, 50.6MB)

Removing: /usr/local/Cellar/xvid/1.3.4... (10 files, 1.2MB)

Removing: /usr/local/Cellar/gdbm/1.13... (19 files, 554.3KB)

Removing: /usr/local/Cellar/python/2.7.13... (6,337 files, 86.7MB)

Removing: /usr/local/Cellar/python/3.6.1... (7,961 files, 110.0MB)

Removing: /usr/local/Cellar/icu4c/58.2... (242 files, 65MB)

Removing: /usr/local/Cellar/carthage/0.25.0... (75 files, 25.8MB)

Removing: /usr/local/Cellar/sqlite/3.18.0... (11 files, 3.0MB)

Removing: /usr/local/Cellar/xz/5.2.2... (91 files, 1.4MB)

Removing: /usr/local/Cellar/watchman/4.1.0... (20 files, 267.2KB)

Removing: /usr/local/Cellar/watchman/4.7.0... (21 files, 429KB)

Removing: /usr/local/Cellar/pcre/8.38... (203 files, 5.4MB)

Removing: /usr/local/Cellar/pcre/8.39... (203 files, 5.4MB)

Removing: /usr/local/Cellar/x264/r2795... (11 files, 3.2MB)

Removing: /usr/local/Cellar/node/7.5.0... (3,146 files, 39MB)

Removing: /usr/local/Cellar/node/7.7.1... (3,148 files, 40.2MB)

Removing: /usr/local/Cellar/openssl/1.0.2h_1... (1,691 files, 12MB)

Removing: /usr/local/Cellar/openssl/1.0.2k... (1,696 files, 12MB)

Removing: /usr/local/Cellar/flow/0.20.1... (7 files, 6.1MB)

Removing: /Users/crifan/Library/Caches/Homebrew/x264-r2795.high_sierra.bottle.tar.gz... (1.3MB)

Removing: /Users/crifan/Library/Caches/Homebrew/lame-3.99.5.high_sierra.bottle.1.tar.gz... (721.6KB)

Removing: /Users/crifan/Library/Caches/Homebrew/xvid-1.3.4.high_sierra.bottle.tar.gz... (440.3KB)

Removing: /Users/crifan/Library/Caches/Homebrew/carthage-0.25.0.high_sierra.bottle.tar.gz... (8.0MB)

Removing: /Users/crifan/Library/Caches/Homebrew/ffmpeg-3.3.4.high_sierra.bottle.tar.gz... (20MB)

Removing: /Users/crifan/Library/Logs/Homebrew/lame... (64B)

Removing: /Users/crifan/Library/Logs/Homebrew/ffmpeg... (64B)

Removing: /Users/crifan/Library/Logs/Homebrew/xvid... (64B)

Removing: /Users/crifan/Library/Logs/Homebrew/carthage... (64B)

Removing: /Users/crifan/Library/Logs/Homebrew/mongodb... (64B)

Removing: /Users/crifan/Library/Logs/Homebrew/sshpass... (6 files, 139.4KB)

Removing: /Users/crifan/Library/Logs/Homebrew/x264... (64B)

Removing: /Users/crifan/Library/Logs/Homebrew/chromedriver... (64B)

Removing: /Users/crifan/Library/Logs/Homebrew/openssl... (64B)

Removing: /Users/crifan/Library/Logs/Homebrew/telnet... (64B)

==> This operation has freed approximately 503.3MB of disk space.

➜  ~ ll /usr/local/mysql

lrwxr-xr-x  1 root  wheel    30B  4 27 11:16 /usr/local/mysql -> mysql-5.7.22-macos10.13-x86_64

➜  ~ sudo rm /usr/local/mysql

Password:

➜  ~ ll /usr/local/mysql*

total 48

-rw-r--r--   1 root    wheel     18K  3  4 21:40 COPYING

-rw-r--r--   1 root    wheel    2.4K  3  4 21:40 README

drwxr-xr-x  40 crifan  wheel    1.3K  4 27 11:16 bin

drwxrwxrwx  10 _mysql  _mysql   320B  4 27 10:59 data

drwxr-xr-x   5 crifan  wheel    160B  4 27 11:16 docs

drwxr-xr-x  50 crifan  wheel    1.6K  4 27 11:16 include

drwxr-x---   2 _mysql  _mysql    64B  4 26 11:28 keyring

drwxr-xr-x  11 crifan  wheel    352B  4 27 11:16 lib

drwxr-xr-x   4 crifan  wheel    128B  3  4 23:24 man

drwxr-xr-x  39 crifan  wheel    1.2K  4 27 11:16 share

drwxr-xr-x   6 crifan  wheel    192B  4 27 11:16 support-files

➜  ~ sudo rm -rf /usr/local/mysql*

➜  ~ ll /Library/StartupItems/My*

ls: /Library/StartupItems/My*: No such file or directory

➜  ~ ll /Library/PreferencePanes/My*

total 0

drwxr-xr-x  6 root  wheel   192B  3  4 23:28 Contents

➜  ~ sudo rm -rf /Library/PreferencePanes/My*

➜  ~ ll /etc/hostconfig

ls: /etc/hostconfig: No such file or directory

➜  ~ ll /Library/Receipts/mysql*

ls: /Library/Receipts/mysql*: No such file or directory

➜  ~ ll /Library/Receipts/com.apple.pkg.iMovie_AppStore.

➜  ~ ll /Library/Receipts/MySQL*

ls: /Library/Receipts/MySQL*: No such file or directory

➜  ~ ll /private/var/db/receipts/*my*

-rw-r--r--  1 root  wheel    35K  4 27 11:16 /private/var/db/receipts/com.mysql.launchd.bom

-rw-r--r--  1 root  wheel   268B  4 27 11:16 /private/var/db/receipts/com.mysql.launchd.plist

-rw-r--r--  1 root  wheel   123K  4 27 11:16 /private/var/db/receipts/com.mysql.mysql.bom

-rw-r--r--  1 root  wheel   263B  4 27 11:16 /private/var/db/receipts/com.mysql.mysql.plist

-rw-r--r--  1 root  wheel    38K  4 27 11:16 /private/var/db/receipts/com.mysql.prefpane.bom

-rw-r--r--  1 root  wheel   273B  4 27 11:16 /private/var/db/receipts/com.mysql.prefpane.plist

➜  ~ sudo rm -rf /private/var/db/receipts/*mysql*

➜  ~ ll /etc/my*

ls: /etc/my*: No such file or directory

➜  ~ cat /Library/Receipts/InstallHistory.plist | grep mysql

com.mysql.mysql

com.mysql.prefpane

com.mysql.launchd

com.mysql.mysql

com.mysql.prefpane

com.mysql.launchd

➜  ~ vi /Library/Receipts/InstallHistory.plist

去相关的的部分删除掉

➜  ~ cat /Library/Receipts/InstallHistory.plist | grep mysql

➜  ~

【总结】

我此处不是brew去install的mysql,所以没法用:brew uninstall mysql

我之前是通过dmg文件:

mysql-5.7.22-macos10.13-x86_64.dmg

去安装的mysql。

现在想要彻底卸载:sudo rm /usr/local/mysql

sudo rm -rf /usr/local/mysql*

sudo rm -rf /Library/PreferencePanes/My*

sudo rm -rf /private/var/db/receipts/*mysql*

sudo rm /Library/LaunchDaemons/*my*

另外:

有些东西:/Library/StartupItems/MySQLCOM

/Library/PreferencePanes/My*

/etc/hostconfig 中的其中一行: MYSQLCOM=-YES-

/Library/Receipts/mysql*

/Library/Receipts/MySQL*

/etc/my.cnf

没有,所以不需要也没法删除:➜  ~ ll /Library/StartupItems/My*

ls: /Library/StartupItems/My*: No such file or directory

➜  ~ ll /etc/hostconfig

ls: /etc/hostconfig: No such file or directory

➜  ~ ll /Library/Receipts/mysql*

ls: /Library/Receipts/mysql*: No such file or directory

➜  ~ ll /Library/Receipts/MySQL*

ls: /Library/Receipts/MySQL*: No such file or directory

➜  ~ ll /etc/my*

ls: /etc/my*: No such file or directory

(注:

参考:

发现很多东西,比如:

/etc/hostconfig 中的其中一行: MYSQLCOM=-YES-

是如果用brew安装的mysql,才会有,我此处用dmg安装的,所以是没有)

而好像还有个相关的历史记录,可不删。

想要删则是:cat /Library/Receipts/InstallHistory.plist | grep mysql

发现有东西,所以也最好去删除掉相关的<dict></dict>的部分

确保:

cat /Library/Receipts/InstallHistory.plist | grep mysql

输出为空

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值