집 >데이터 베이스 >MySQL 튜토리얼 >Can’tconnecttolocalMySQLserverthroughsocket解决办法_MySQL
故障描述:
启动mysql 报错:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
1.先查看mysql启动状态
#/etc/rc.d/init.d/mysqld status
2.mysql.sock位置查找与验证?
# find / -name mysql.sock备注:-S参数socket file文件验证
3.验证mysql.sock文件权限和用户是否正确?4.永久解决
修改/etc/my.cnf
添加以下内容到/etc/my.conf: