安裝Cacti的過程當中配置了數據庫,但因爲是在虛擬機裏作的,習慣性的關機直接是Force off硬關機,剛配置完的cacti在我非正常關機重起後出現了問題,問題以下:mysql
[root@server2 ~]# /etc/init.d/mysqld start
Another MySQL daemon already running with the same unix socket.
Starting mysqld: [FAILED]
sql
重點在這一句:Another MySQL daemon already running with the same unix socket.數據庫
查閱了很多資料,終於找到了答案,緣由是,在mysql安裝目錄裏有一個mysql.sock文件。這個文件在mysql啓動時建立的,mysql關閉時刪除。那若是是非正常關機,mysql就沒有機會去刪除之個文件。當這個文件還存在時,mysql就啓動不了,提示上面的錯誤。socket
兩個方法解決:ide
第一個是當即關機 使用命令 shutdown -h now 關機,關機後在啓動,進程就中止了。this
第二個直接把mysql.sock文件更名便可。也能夠刪除,推薦更名。而後就能夠啓動mysql了spa
下面是國外原文
unix
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 noworm
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.sockserver