参考 https://tableplus.com/blog/2018/08/solved-cant-connect-to-local-mysql-server-through-socket.html
错误消息为:
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘
症状,是msyql 命令可以通过root@127.0.0.1登录到msyql服务器,但是无法通过root@localhost登录
解决办法,修改msyql的配置文件,/etc/my.cnf
[mysqld] socket=/var/lib/mysql/mysql.sock [client] socket=/var/lib/mysql/mysql.sock
重启msyqld服务。