MySQL錯誤Another MySQL daemon already running with the same unix socket.

    

        安裝Cacti的過程中配置了數據庫,但由於是在虛擬機裏做的,習慣性的關機直接是Force off硬關機,剛配置完的cacti在我非正常關機重起後出現了問題,問題如下:


[root@server2 ~]# /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



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章