Mac登录MySql错误解决办法

Cherish
2021-06-10 / 0 评论 / 145 阅读
温馨提示:
本文最后更新于2021-06-10,若内容或图片失效,请留言反馈。

网上找了许多教程,最终下面方法可行,特此记录。

~ mysql -u root -p
Enter password:
# 输入密码后报错
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
# 终端执行以下命令
~ sudo /usr/local/mysql/support-files/mysql.server start

Starting MySQL
.Logging to '/usr/local/mysql/data/zhengjiedeMac-mini.local.err'.
 SUCCESS!

再次登陆即可!

# 启动mysql
~ sudo /usr/local/mysql/support-files/mysql.server start
Starting MySQL
. SUCCESS!

# 查看mysql运行状态
~ sudo /usr/local/mysql/support-files/mysql.server status
Password:
Sorry, try again.
# 输入mac系统密码
Password:
 SUCCESS! MySQL running (2893)

~ sudo /usr/local/mysql/support-files/mysql.server status
 ERROR! MySQL is not running


# 关闭mysql
~ sudo /usr/local/mysql/support-files/mysql.server stop
Shutting down MySQL
. SUCCESS!

参考:https://blog.csdn.net/potato512/article/details/78564106