Mysql failed to start, and it reported Can't start server: can't create PID file: No such file or directory

table of Contents

1. Reason analysis

2. Problem positioning

Three, the solution


1. Reason analysis

Change the MySQL data storage location to the address of the data disk, restart the machine, and then the disk mount is not set to automatically mount at startup, resulting in the PID file not being found.

2. Problem positioning

  Check the log, /var/log/mysql check the reason

Three, the solution

1. Check the location of pid-file in /etc/my.cnf

pid-file=/var/run/mysqld/mysqld.pid

2. Create the corresponding directory and modify permissions

mkdir -p /var/run/mysqld
chown mysql.mysql /var/run/mysqld

At this time, you can try to restart mysql. If it still does not work, continue to the third step. At this step, my MySQL has been started.

3. Create a pid file and modify permissions

touch /var/run/mysql/mysqld.pid
chown mysql.mysql /var/run/mysql/mysqld.pid

Restart MySQL should be no problem

Guess you like

Origin blog.csdn.net/qq_35995514/article/details/108236961