MySQL tips :The server quit without PID file problem solution

  • 2020-06-15 10:23:37
  • OfStack

df command looked up, as expected the disk is full, because at that time the partition USES the system default, do not know why can not automatically expand capacity! Deal with this problem later! As shown in the figure:

[root@snsgou ~]# df
 The file system                  1K- block        Has been used        available   Has been used %  The mount point 
/dev/mapper/vg_snsgou-lv_root
51606140  47734848   1249852  100%      /
tmpfs                  1953396        88   1953308   1%           /dev/shm
/dev/sda1               495844     37062    433182   8%        /boot
/dev/mapper/vg_snsgou-lv_home
229694676    191796 217835016   1%       /home
[root@snsgou ~]#

After deleting some useless logs, there was an error restarting the database.
[root@snsgou mysql]# service mysql restart
MySQL server PID file could not be found![ failure ]
Starting MySQL...The server quit without updating PID file (/usr/local/mysql/data/snsgou.pid).[ failure ]


Google, the problem can be caused by a variety of reasons, the best way is to check the error log:
1, may be/usr/local mysql/data/mysql pid files do not have permission to write
Solution: to give permission, the implementation of the "chown - R mysql: mysql var/data" "chmod - 755 / usr local R/mysql data" and then restart the mysqld!

2. The mysql process may already exist in the process
Solution: use the command "ps-ef |grep mysqld" to see if there is an mysqld process. If there is, use "kill-9 process number" to kill, then restart mysqld!

3. mysql may be installed on the machine for the second time, and the startup of the service is affected by residual data.
Solution: Go to mysql's data directory /data. If there is mysql-ES50en.index, delete it as the culprit. I use the 3rd method to solve!

4. mysql will use /etc/ my.cnf profile when it is not specified at startup. Please open this file to see if there is a specified data directory (datadir) under [mysqld].
Solution: please set up under the [mysqld] this line 1: datadir = / usr local/mysql/data

5. skip-federated field
Solution: Check the 1 /etc/ my.cnf file for uncommented fields of ES75en-ES76en, if any, comment them out immediately.

6. Error log directory does not exist
Solution: Use the "chown" "chmod" commands to give mysql the owner and permissions

7, selinux, if the centos system, default will be turned on selinux
Solution: Close it, open /etc/selinux/config, change SELINUX=enforcing to SELINUX=disabled, save, exit, and restart the machine.


Related articles: