Mysql After the server loses power, it discovers that the site link database failed, after viewing the data set status
[Email protected]~]# service mysqld Status
Mysqldis stopped
[Email protected]dbserver1~]# chkconfig--list mysqld
Mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[[Email protected]~]# service mysqld Start
Another mysqldaemon already running with the same UNIX socket
View socket in MY.CNF File Location
Socket=/var/lib/mysql/mysql.sock
[Email protected]~]# ls-l/var/lib/mysql/mysql.sock
Discovery exists, guess is power off after Mysql.sock is not cleared, legacy issues
When the database was started, Mysql.sock was found to be present, so MySQL failed to start
Workaround:
[[Email protected]~]# Mv/var/lib/mysql/mysql.sock/var/lib/mysql/mysql.sock.bak
[[Email protected]~]# service mysqld Start
STARTINGMYSQLD: [OK]
The same test on other servers, after the power outage, MySQL can start normally
To prevent this problem, you can add the following code after "start" in/etc/init.d/mysqld
Test-e/var/lib/mysql/mysql.socksockexist=$? PS CAx | grep mysqld_safenopidmysql=$? echo nopidmysql $NOPIDMYSQLecho sockexist $SOCKEXIST If [$NOPIDMYSQL-eq 1] && [$SOCKEXIST-eq 0]; Then echo "Notclean" Rm-f/var/lib/mysql/mysql.sock echo "FILE sockremoved" Else echo "clean" fi
This article is from "The girl said" blog, please be sure to keep this source http://sugarlovecxq.blog.51cto.com/6707742/1679996
Another MySQL daemon already running with the same UNIX socket