Linux上mysql登陆错误解决办法ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'



解决方法: 1:首先确认你在root权限下

[root@localhost tmp]# mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

2:确保你的mysql关闭

service mysqld stop

3:将你本身安装目录下的mysql设快捷键到规定的目录下

ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

4:重新打开mysql

[root@localhost tmp]# service mysqld start

5:成功mysql -u root -p

Linux上mysql登陆错误解决办法ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/_第1张图片


你可能感兴趣的:(mysql)