如何从 Mac OS X 卸载 MySQL?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1436425/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 14:06:40  来源:igfitidea点击:

How do you uninstall MySQL from Mac OS X?

mysqlmacososx-snow-leopard

提问by Joseph Ravenwolfe

I accidentally installed the PowerPC version of MySQL on my Intel Mac in Snow Leopard, and it installed without a problem but of course doesn't run properly. I just didn't pay enough attention. Now when I try to install the correct x86 version it says that it can't install because a newer version is already installed. A Google query led me to perform these actions/delete these files to uninstall it:

我不小心在 Snow Leopard 的 Intel Mac 上安装了 PowerPC 版本的 MySQL,它安装没有问题,但当然不能正常运行。只是我没有引起足够的重视。现在,当我尝试安装正确的 x86 版本时,它说无法安装,因为已经安装了较新的版本。谷歌查询使我执行这些操作/删除这些文件以卸载它:

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/MySQL*
rm -rf ~/Library/PreferencePanes/MySQL*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*

And finally removed the line MYSQLCOM=-YES- from /etc/hostconfig

最后删除了 MYSQLCOM=-YES- 行 /etc/hostconfig

They haven't seemed to help at all. I am still receiving the same message about there being a newer version. I tried installing an even newer version (the current Beta) and it also gave me the same message about a newer version already being installed. I can't uninstall it from the Prefs Pane because I never installed the PrefPane also.

他们似乎根本没有帮助。我仍然收到关于有更新版本的相同消息。我尝试安装一个更新的版本(当前的 Beta),它也给了我关于已经安装的更新版本的相同消息。我无法从 Prefs 窗格中卸载它,因为我也从未安装过 PrefPane。

回答by Sophie Alpert

Try running also

也试试跑步

sudo rm -rf /var/db/receipts/com.mysql.*

回答by rm-rf

I also had entries in:

我也有条目:

/Library/Receipts/InstallHistory.plist

that i had to delete.

我不得不删除。

回答by bapu

If you installed mysql through brew then we can use command to uninstall mysql.

如果你通过 brew 安装了 mysql,那么我们可以使用命令来卸载 mysql。

$ brew uninstall mysql

Uninstalling /usr/local/Cellar/mysql/5.6.19...

This worked for me.

这对我有用。

回答by Victor

ps -ax | grep mysql

*stop and kill any MySQL processes

*停止并杀死任何 MySQL 进程

brew remove mysql
brew cleanup

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/MySql*

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

edit /etc/hostconfigand remove the line MYSQLCOM=-YES-

编辑/etc/hostconfig并删除该行MYSQLCOM=-YES-

rm -rf ~/Library/PreferencePanes/My*    
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*

*restart your computer just to ensure any MySQL processes are killed try to run mysql, it shouldn't work

*重新启动您的计算机只是为了确保杀死任何 MySQL 进程尝试运行 mysql,它不应该工作

回答by mblackwell8

Aside from the long list of remove commands in your question, which seems quite comprehensive in my recent experience of exactly this issue, I found mysql.sock running in /private/var and removed that. I used

除了您问题中的一长串删除命令(在我最近对这个问题的经验中似乎相当全面)之外,我发现 mysql.sock 在 /private/var 中运行并将其删除。我用了

find / -name mysql -print 2> /dev/null

find / -name mysql -print 2> /dev/null

...to find anything that looked like a mysql directory or file and removed most of what came up (aside from Perl/Python access modules). You may also need to check that the daemon is not still running using Activity Monitor (or at the command line using ps -A). I found that mysqld was still running even after deleting the files.

...找到任何看起来像 mysql 目录或文件的内容并删除大部分内容(除了 Perl/Python 访问模块)。您可能还需要使用 Activity Monitor(或在命令行中使用ps -A)检查守护程序是否仍在运行。我发现即使删除文件后 mysqld 仍在运行。

回答by Dirk de Kok

I also had a config file at /etc/my.cnf that I needed to delete on my Mac OS X Snow Leopard install

我还在 /etc/my.cnf 中有一个配置文件,我需要在 Mac OS X Snow Leopard 安装中删除它

回答by mhoeffner

It might be overkill but your MySQL command history can also be wiped from:

这可能有点矫枉过正,但您的 MySQL 命令历史记录也可以从以下位置擦除:

~/.mysql_history

回答by Brian Lyttle

You need to identify where MySQL was installed to before attempting to delete it.

在尝试删除 MySQL 之前,您需要确定 MySQL 的安装位置。

I always use the Hivelogic guideto installing under Mac OS X which builds MySQL from source. When setting up the build you can specify a directory under which to install MySQL with the --prefixparameter. You should make sure the directory does not exist and attempt to install from source.

我总是使用Hivelogic 指南在 Mac OS X 下安装,它从源代码构建 MySQL。设置构建时,您可以使用--prefix参数指定安装 MySQL 的目录。您应该确保该目录不存在并尝试从源代码安装。

./configure --prefix=/usr/local/mysql --with-extra-charsets=complex \
--enable-thread-safe-client --enable-local-infile --enable-shared \
--with-plugins=innobase

回答by Dave

You should also check /var/db/receipts and remove all entries that contain com.mysql.*

您还应该检查 /var/db/receipts 并删除所有包含 com.mysql.* 的条目

Using sudo rm -rf /var/db/receipts/com.mysql.* didn't work for me. I had to go into var/db/receipts and delete each one seperately.

使用 sudo rm -rf /var/db/receipts/com.mysql.* 对我不起作用。我不得不进入 var/db/receipts 并单独删除每一个。

回答by rmc

For me, I had installed MariaDB years ago using homebrew. Correct uninstall procedure was: brew uninstall mariadb.

对我来说,我多年前使用自制软件安装了 MariaDB。正确的卸载程序是:brew uninstall mariadb。