ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'跟swap

今天发现作为自己毕业设计的主数据库登录不进去了,每次遇到这种问题,心都虚了半截。

报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

上一次遇到这种问题的时候停一下然后重启即可

 service mysqld stop

service mysqld start

但是这次却不行,启动报错:

Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

就 netstat -ntlp  | grep 3306查看实例状态

再次执行more /etc/my.cnf |grep sock 


发现socket中的var少了一个  “/”,当时就轻松了,以为解决问题,,,,修改、etc下的my.conf,启动仍然不行(现在明白这里的配置不影响启动,但是会影响到你的登录)

执行上面的 systemctl status mysqld.service 和  journalctl -xe 并没有发现有效的信息,百度到最有用的信息就是:

自己看日志发火。。

那就自己看日志吧,tail -n 100 /etc/log/mysql.log

130629  5:46:48 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
130629  5:46:48 InnoDB: Completed initialization of buffer pool
130629  5:46:48 InnoDB: Fatal error: cannot allocate memory for the buffer pool
130629  5:46:48 [ERROR] Plugin 'InnoDB' init function returned error.
130629  5:46:48 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
130629  5:46:48 [ERROR] Unknown/unsupported storage engine: InnoDB
130629  5:46:48 [ERROR] Aborting

把错误复制出去百度,发现是由于swap的问题。(这里套用别人的图)



确实执行到这里就解决问题。可以进行启动和登录了。。。mysql启动报错太过于模糊,百度搜索答案去尝试太耗时,以后做到看完日志再去寻找答案。

关于swap其实我是第一次听说。。。然后百度搜索 看到这样一篇文章  希望对大家有帮助

点击打开链接


猜你喜欢

转载自blog.csdn.net/qq442270636/article/details/79818533
今日推荐