1. 程式人生 > >無法使用資料庫Can't connect to local MySQL server through socket

無法使用資料庫Can't connect to local MySQL server through socket

1、shell面板登陸mysql出現這個問題

2、Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

3、出現這個問題首先使用安全模式登陸用這個命令進入安全模式mysqld_safe --skip-grant-tables &

4、新開啟一個shell視窗,mysql -uroot -p,回車不輸入密碼,可以進入資料庫。

5、輸入use mysql 回車,輸入update user set password=password("XXXXX") where user="root";回車

6、flush privileges;重新整理

7、exit 退出。重啟mysql的服務即可。