brew services list shows mysql running but cannot connect

半世苍凉 提交于 2019-12-06 04:24:30

问题


I followed instructions on installing mysql using brew from here https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e

brew services list shows below output

Name  Status  User         Plist
mysql started <username> /Users/<username>/Library/LaunchAgents/homebrew.mxcl.mysql.plist

But when I run 'mysql' or 'mysqladmin -u root password '' I get error.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Can anybody tell the issue here.


回答1:


What is your MySQL version? Recently MySQL v8 was released and it is causing problems.

I suggest to first stop the MySQL service via brew services stop mysql and then uninstall MySQL via brew uninstall mysql.

Next, please remove its data folder by executing rm -rf /usr/local/var/mysql.

After that please do brew upgrade.

If you want to install MySQL v5.7 just do

brew install mysql@5.7 && brew link --force mysql@5.7 && brew services start mysql@5.7

This also works for mysql@5.6 and mysql@5.5.



来源:https://stackoverflow.com/questions/51511863/brew-services-list-shows-mysql-running-but-cannot-connect

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!