通过以下命令安装MySQL:
$ brew install mysql56
$ brew services start mysql@5.6
现在我无法访问它:
$ mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
想要卸载它并尝试了以下方法:
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
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 computer)
现在开始工作。
当我重新安装并运行时:
brew intall mysql56
brew services start mysql@5.6
它显示:
Service `mysql@5.6` already started, use `brew services restart mysql@5.6` to restart.
但我在进程列表中找不到它。
mysql 56
-mysql@5.6
也不起作用。我无法使用此命令找到mysql:sudo launchctl list | grep -i mysql
。但是仍然会显示此消息:Service
mysql@5.6already started, use
brew services restart mysql@5.6to restart.
。 - zseikyochobrew
的mysql
并直接从.dmg
文件中安装解决了它。在卸载后,你是否重新启动了电脑并检查它是否仍在运行?如果是的话,那么你可能有一个异常情况。 - JayRizzobrew remove mysql56
和brew install mysql56
。现在它可以正常工作了!请确保将此路径替换为/usr/local/opt/mysql@5.6
。 - zseikyochobrew remove mysql56
后,路径/usr/local/opt/
不应该包含mysql@5.6
文件夹。当再次运行brew install mysql56
时,它将重新生成。 - zseikyocho