I. Overview
This article mainly introduces the problem caused by starting the MySQL service error: "error! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid), Incidentally expands some other knowledge points, The current version is Red Hat 6,mysql 5.6.
Second, the steps
The source of the error
Problem solving
1. Permissions
The source of the error is it, generally this problem will be the first to think of the issue of permissions, that is,/var/lib/mysql the permissions of the folder
The image above can see the MySQL folder users and groups are MySQL and MySQL has write permission, so there is no problem with permissions.
2. The process
View/var/lib/mysql directory, found no survival mysql.sock file, that MySQL did not start, you can log into MySQL to test
View process ps-ef|grep MySQL
Found the MySQL process, the reason is it, kill off, Kill-9 PID
Then start the MySQL service, service MySQL start, my current version of MySQL is 5.6, in the 5.7 version of the service mysqld start is a little bit different.
View MySQL directory, found mysql.sock file generated
Problem analysis
Do you remember the first error?
There is already a MySQL process, but why stop MySQL service hint can not find the process, the main reason is that the process is stored in the MySQL process, the solution is to kill these processes in accordance with the above, why will this process occur? I here is my own error, the server started MySQL automatically started, and then I also performed a service MySQL start, which led to this problem, this is the origin of the problem, there are many articles online is aimed at this solution but did not find out the origin of the problem, There may be other reasons for this problem, but I'm here because I started the service repeatedly because the MySQL service did not automatically reboot in the mysql5.7 version so I often have the habit of restarting the service, but in version 5.6 MySQL is with the system automatically started so no need to restart the service.
System Automatic Restart Service
Chkconfig command
Use the Chkconfig command to query for service restart conditions, command: Chkconfig--list servername, or you can chkconfig view all
[0-6] represents the operating mode of Linux systems, respectively, 0: Downtime, 1: Single-user mode, 2: Multi-User with no network, 3: Multiuser without graphical interface, 4: Not used, 5: Mode with graphical interface X11 is often seen on the Linux desktop (default level), 6: Reboot
You can use the Chkconfig--level level service name On/off method to shut down and start a service
For example we turn off MySQL at the linux2,3,4,5 run level of automatic startup,
Chkconfig--level 2345 MySQL off
Here's an article about automatic startup services that's a good summary: How Linux sets up a service from startup
View Boot.log Log
Command:cat/var/log/boot.log
Boot.log records the log information for the startup item.
The article is mainly to write their own problems found to find the problem of the method, by the way to expand the system to automatically start the information, I hope to help you learn.