Linux MySQL prompt: The server quit without updating PID file problem solving

Keywords: MySQL PHP Nginx Apache

The previous testing machine used by the company did not empty the original data, resulting in multiple environment versions of mysql, php, nginx, and apache. Because the php version is 5.2, it is too low for testing. I installed the integrated environment directly for the convenience of testing.

By checking mysql logs and looking at the file directory

Problems found: mysql.sock and mysql pid files are missing, which leads to the failure of MySQL startup

mysqld_safe mysqld from pid file /phpstudy/data/lf-xgo-yanglin-web1.leftbrain.com.cn.pid ended

180929 09:02:02 mysqld_safe mysqld from pid file /phpstudy/data/lf-xgo-yanglin-web1.leftbrain.com.cn.pid ended
180929 09:04:35 mysqld_safe Starting mysqld daemon with databases from /phpstudy/data
^G/phpstudy/mysql/bin/mysqld: File './mysql-bin.index' not found (Errcode: 13)
180929  9:04:35 [ERROR] Aborting

180929  9:04:35 [Note] /phpstudy/mysql/bin/mysqld: Shutdown complete

180929 09:04:35 mysqld_safe mysqld from pid file /phpstudy/data/lf-xgo-yanglin-web1.leftbrain.com.cn.pid ended
180929 09:11:53 mysqld_safe Starting mysqld daemon with databases from /phpstudy/data
^G/phpstudy/mysql/bin/mysqld: File './mysql-bin.index' not found (Errcode: 13)
180929  9:11:53 [ERROR] Aborting

180929  9:11:53 [Note] /phpstudy/mysql/bin/mysqld: Shutdown complete

180929 09:11:53 mysqld_safe mysqld from pid file /phpstudy/data/lf-xgo-yanglin-web1.leftbrain.com.cn.pid ended
180929 09:12:03 mysqld_safe Starting mysqld daemon with databases from /phpstudy/data
^G/phpstudy/mysql/bin/mysqld: File './mysql-bin.index' not found (Errcode: 13)
180929  9:12:03 [ERROR] Aborting

 

Solution

Regenerate the sock file through mysqld_safe under the bin directory of mysql

./mysqld_safe  --user=mysql --basedir=/phpstudy/mysql  --datadir=/phpstudy/mysql/data &

Delete the three files ibdata1 IB logfile0 IB logfile1 under the data directory of mysql

Finally, restart the environment. If it still doesn't work, your data is not very important. The direct, simple, rough and effective way is to reinstall mysql. If you can't make sure, please kill me!

Posted by johnb352 on Sun, 22 Dec 2019 10:55:54 -0800