码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2015-01-26 01:24:40      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:

今天mysql不知道犯啥病,root登录的时候一直报这个错误。

在国内网站找了找,没什么合适的 答案,在stackoverflow和ubuntu的一个社区上找到了答案,搞定了,但是没太看懂,记录一下,以后再翻。


That said, Here is what I did/ found out:
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'

标签:

原文地址:http://blog.csdn.net/zy598403285/article/details/43128991

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!