Can't connect to local MySQL server through socket '/tmp/mysql.sock

253 阅读1分钟

许久没有连接mac的mysql数据库,今天打开,突然报错Can't connect to local MySQL server through socket '/tmp/mysql.sock。

解决办法:

1、先检查mysql服务是否在运行

ps -ef|grep mysql

发现没有运行。

2、通过以下命令重启mysql服务解决

mysql.server restart