最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

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

Mac crifan 552浏览 0评论

折腾:

【已解决】Mac中mysql中创建数据库出错:ERROR 1006 HY000 Can’t create database errno 230174752

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

mac uninstall mysql dmg

Remove MySQL completely from Mac OSX

<code>➜  ~ 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
➜  ~
</code>

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

<code>➜  ~ 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)
==&gt; This operation has freed approximately 503.3MB of disk space.
</code>

Uninstall MySql on a Mac OS X | Jaspersoft Community

macos – How do you uninstall MySQL from Mac OS X? – Stack Overflow

How to Uninstall MySQL on macOS

Mac下MySql卸载方法

Uninstall MySQL Server on macOS – Soufiane R – Medium

Mac下MySQL卸载方法 – 简书

<code>➜  ~ ll /usr/local/mysql
lrwxr-xr-x  1 root  wheel    30B  4 27 11:16 /usr/local/mysql -&gt; 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

</code>

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

            <string>com.mysql.mysql</string>

            <string>com.mysql.prefpane</string>

            <string>com.mysql.launchd</string>

            <string>com.mysql.mysql</string>

            <string>com.mysql.prefpane</string>

            <string>com.mysql.launchd</string>

➜  ~ vi /Library/Receipts/InstallHistory.plist

去相关的<dict></dict>的部分删除掉

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

➜  ~

【总结】

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

<code>brew uninstall mysql
</code>

我之前是通过dmg文件:

mysql-5.7.22-macos10.13-x86_64.dmg

去安装的mysql。

现在想要彻底卸载:

<code>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*
</code>

另外:

有些东西:

<code>/Library/StartupItems/MySQLCOM
/Library/PreferencePanes/My*
/etc/hostconfig 中的其中一行: MYSQLCOM=-YES-
/Library/Receipts/mysql*
/Library/Receipts/MySQL*
/etc/my.cnf
</code>

没有,所以不需要也没法删除:

<code>➜  ~ 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
</code>

(注:

参考:

Remove MySQL completely from Mac OSX

发现很多东西,比如:

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

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

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

想要删则是:

<code>cat /Library/Receipts/InstallHistory.plist | grep mysql
发现有东西,所以也最好去删除掉相关的&lt;dict&gt;&lt;/dict&gt;的部分
确保:
cat /Library/Receipts/InstallHistory.plist | grep mysql
输出为空
</code>

转载请注明:在路上 » 【已解决】Mac中如何彻底卸载之前通过dmg安装的mysql

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
67 queries in 0.149 seconds, using 18.82MB memory