Home>Article>Operation and Maintenance> Solution to centos failure to start mysql

Solution to centos failure to start mysql

尚
Original
2020-03-25 17:36:09 3244browse

Solution to centos failure to start mysql

1. The datadir item of the my.cnf configuration file is configured incorrectly or has been tampered with by the startup script

Mysql’s own startup file (/etc/init.d/mysqld) The data storage directory of mysql will be automatically detected. If mysql is newly installed and the system tables have not been initialized, it does not matter whether the datadir item in the configuration file is written or not. This situation occurs mainly because the data storage directory of mysql is changed.

Recommended tutorial:centos usage tutorial

2. The mysql process already exists in the process

Use the following command to view the existing process:

ps -ef|grep mysql

If they exist, the existing zombie processes will be listed after the command is executed. Just kill -9 `pid` to remove them.

3. Insufficient permissions of the data storage directory of mysql

This situation occurs when mysql is installed or upgraded for the first time. The permissions of the datatdir directory in the configuration file must be set properly. Generally speaking, The user and group running mysql is mysql.mysql, so the method to solve the problem of insufficient permissions is as follows:

chown -R mysql.mysql /data/mysql ##This command is only an example, where /data/mysql is The directory of datadir in the mysql configuration file ##If it is empty, it defaults to the data folder in the mysql installation directory.

4. The impact of residual data after overwriting, installing or upgrading mysql

This situation occurs after mysql is overwritten, installed or upgraded. Of course, this situation will also occur after mysql goes down for no reason. , which may affect the data files started by mysql, generally exist in the data storage directory of mysql (this directory varies according to the datadir in the my.cnf configuration file), that is, the mysql-bin.index file that exists in the mysql data storage directory , delete it.

Recommended related video tutorials:linux video tutorial

The above is the detailed content of Solution to centos failure to start mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn