1. 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” Then restart mysqld!
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 the second time I installed mysql on the machine, 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. I solved it using the third method!
4. When mysql does not specify a configuration file when starting, it will use the /etc/my.cnf 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. Skip-federated field problem Solution: Check if there is any in the /etc/my.cnf file If there are any skip-federated fields that are commented out, comment them out immediately.
6. The error log directory does not exist Solution: Use the "chown" "chmod" command to give mysql owner and permissions
7. Selinux is the cause of trouble. If it is a centos system, selinux will be turned on by default Solution: Close For it, open /etc/selinux/config, change SELINUX=enforcing to SELINUX=disabled, save and exit, and try restarting the machine.
1. 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” Then restart mysqld!
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 the second time I installed mysql on the machine, 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. I solved it using the third method!
4. When mysql does not specify a configuration file when starting, it will use the /etc/my.cnf 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. Skip-federated field problem
Solution: Check if there is any in the /etc/my.cnf file If there are any skip-federated fields that are commented out, comment them out immediately.
6. The error log directory does not exist
Solution: Use the "chown" "chmod" command to give mysql owner and permissions
7. Selinux is the cause of trouble. If it is a centos system, selinux will be turned on by default
Solution: Close For it, open /etc/selinux/config, change SELINUX=enforcing to SELINUX=disabled, save and exit, and try restarting the machine.
Baidu has a lot of solutions...