当前位置:Gxlcms > 数据库问题 > ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

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

时间:2021-07-01 10:21:17 帮助过:7人阅读


1. You don‘t have to change the tmp directory in the my.cnf file. Even adding a second directory, changing from tempdir =/tmp to =/tmp:/newdir crashed mysql. In 10.04 using MySQL 5.1 you used to have to add the second path other wise you got an error something like can‘t write temp file.... Of course did change the datadir to /MyDisk/myNewDir

2. Used the wrong permission flags on my file copy from the command line. Should use cp -R -p /var/lib/mysql /MyDisk/myNewDir. Not sure if that really mattered as trashed old dir and started over with the flags as stated so did not test with old permissions. This did work.

3. Added /MyDisk/myNewDir/ r, and /MyDisk/myNewDir/* rwk, to the bottom of etc/apparmor.d/usr.sbin.mysqld file. Also changed the var/lib/mysql entries in apparmor as above

4. Left in the var/run... file as created above. Also not sure if that matters but already behind in getting the server updated so not really caring past having it working properly. 

sudo service mysql stop
sudo /etc/init.d/apparmor reload
sudo service mysql start 


and this worked.


没看太懂,也没时间翻译了,先欠着吧。。红字是解决方法。

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

标签:

人气教程排行