MySQL错误Another MySQL daemon already running with the same unix socket.
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL错误Another MySQL daemon already running with the same unix socket.相关的知识,希望对你有一定的参考价值。
安装Cacti的过程中配置了数据库,但由于是在虚拟机里做的,习惯性的关机直接是Force off硬关机,刚配置完的cacti在我非正常关机重起后出现了问题,问题如下:
[[email protected] ~]# /etc/init.d/mysqld start
Another MySQL daemon already running with the same unix socket.
Starting mysqld: [FAILED]
重点在这一句:Another MySQL daemon already running with the same unix socket.
查阅了不少资料,终于找到了答案,原因是,在mysql安装目录里有一个mysql.sock文件。这个文件在mysql启动时创建的,mysql关闭时删除。那如果是非正常关机,mysql就没有机会去删除之个文件。当这个文件还存在时,mysql就启动不了,提示上面的错误。
两个方法解决:
第一个是立即关机 使用命令 shutdown -h now 关机,关机后在启动,进程就停止了。
第二个直接把mysql.sock文件改名即可。也可以删除,推荐改名。然后就可以启动mysql了
下面是国外原文
To prevent the problem from occurring, you must perform a
graceful shutdown of the server from the command line rather than
powering off the server.
# shutdown -h now
This will stop the running services before powering down the machine.
Based on Centos, an additional method for getting it back up again when you run into this problem is to move mysql.sock:
# mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
# service mysqld start
Restarting the service creates a new entry called mqsql.sock
本文出自 “技术人生,简单不简单” 博客,请务必保留此出处http://willis.blog.51cto.com/11907152/1865685
以上是关于MySQL错误Another MySQL daemon already running with the same unix socket.的主要内容,如果未能解决你的问题,请参考以下文章
MySQL故障处理一例_Another MySQL daemon already running with the same unix socket
Another MySQL daemon already running with the same unix socket.
mysql select in another select group:下线有多少人?
Linux / mysql: is it safe to copy mysql db files with cp command from one db to another?
where column in from another select results with limit (mysql/mariadb)