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

今天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.


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

附个链接ubuntu forum

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值