Mysql startup error: The server quit without updating PID file Several solutions

If the database reports this error, there is no error in the log, and the configuration file and directory permissions are correct. You can use the following command to check whether there are any missing dependent files 1. /usr/
local/mysql/bin/mysqld -V
2. Check the configuration file If the encoding has changed, replace it with a normal configuration file and restart the test.

1. Directory permission issues:
Authorize the installation directory and data directory of mysql separately.

# chown -R mysql.mysql /usr/local/mysql
# chown -R mysql.mysql /data/mysql
# service mysqld start

Or it is caused by configuration items in the configuration file. Roll back your own modified configuration. This error can be displayed in the error log of the database.

2. The mysql process may already exist in the process.
Solution: Use the command "ps -ef|grep mysqld" to check whether there is a mysqld process. If there is, use "kill -9 process ID" to kill it, and then restart mysqld!

3. It may be that mysql is installed on the machine for the second time, and there is residual data that affects the startup of the service.
Solution: Go to the mysql data directory/data and take a look. If mysql-bin.index exists, delete it quickly. It is the culprit.

4. Mysql will use the /etc/my.cnf configuration file when it is started without specifying a configuration file. Please open this file to check whether the data directory (datadir) is specified under the [mysqld] section.
Solution: Please set this line under [mysqld]: datadir = /usr/local/mysql/data

5. It may be that the /usr/local/mysql/data/mysql.pid file does not have write permission
. Solution: Give permission and execute "chown -R mysql:mysql /var/data" "chmod -R 755 /usr/local/ mysql/data" and then restart mysqld!

6. The trouble caused by selinux. If it is a centos system, selinux will be enabled by default.
Solution: close it, open /etc/selinux/config, change SELINUX=enforcing to SELINUX=disabled, save and exit, and try restarting the machine.

7. Delete the "ib_*" files in the mysql library file /data/mysql/. Note: ** Be sure to back up the database before performing this operation, because ibdata1 stores all data files. If you accidentally delete the library, That would be terrible! ! ! (The legendary move from deleting the database to running away...), and then restart mysql.

8. Check the log and you will find the following error message: Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
Solution:

[root@localhost mysql]# rm -rf ib_logfile*

Then start mysql and the problem is solved!

9. Looking at the log, there are words like "initialize buffer pool, size=128.0M" and "cannot allocate memory for the pool", which probably means that it cannot allocate enough memory for the pool to use. At this time, I thought that there were relevant configurations in the mysql configuration file, so I changed the following parameters:
innodb_buffer_pool_size = 128
#The value in the configuration file defaults to 128M.
Adjust this value to a smaller value, start the mysql service again, and the problem is solved!

10. Mysql dependency files are missing on the system

# yum -y install libaio 
# yum -y install numactl

Restart the mysql service and the problem is solved

Guess you like

Origin blog.csdn.net/weixin_42272246/article/details/125534149