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

mysql启动失败:Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) 10

请不要到网上找前篇一律复制的东西,同一篇文章可能是上千人看都不看一眼的采集下去
我实验次数不下50遍了,要是能解决不在这里提问
以前好好的,今天打开网站提示:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
查看mysql日志看到今天日志:
140526 13:40:23 InnoDB: Initializing buffer pool, size = 8.0M
140526 13:40:23 InnoDB: Completed initialization of buffer pool
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
140526 13:40:23 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
140526 13:40:23 InnoDB: Started; log sequence number 0 44233
140526 13:40:23 [ERROR] /usr/libexec/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 13)
140526 13:40:23 [ERROR] Can't start server: can't create PID file: Permission denied
140526 13:40:23 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

linux是centos mysql这些是通过yum安装的,能解决万谢
收起
宇宙级黑阔  |  浏览 19751 次
发布于2014-11-30 21:17 最佳答案
刚解决了一样的问题。
mysql默认是使用/var/lib/mysql/mysql.sock启动的,你可能移动过位置,现在找不到/var/lib/mysql/mysql.sock这个文件了,我是使用xampp解压缩的,根本不会去创建这个文件
解决方法:
先去/var/lib/看看有没有mysql这个目录,没有的话创建一个
找一下看看mysql.sock这个文件在哪里,记住位置,假设为/path/to/mysql/mysql.sock
在/var/lib/mysql创建一个link:ln -s /var/lib/mysql/mysql.sock /path/to/mysql/mysql.sock
重启一下mysql,ok!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值