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 /Users//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.

解决方案

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.

GitHub 加速计划 / br / brew
40.41 K
9.47 K
下载
🍺 The missing package manager for macOS (or Linux)
最近提交(Master分支:1 个月前 )
90a90b30 3 个月前
47b1cab7 3 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐