Highlights about CentOS MySQL operations
How to operate MySQL on CentOS:
1. The problem [root @ rekfanmysql] # service mysql restart occurs.
MySQL server PID file cocould not be found! [Failed]
Starting MySQL... The server quit without updating PID file (/usr/local/mysql/data/rekfan. pid). [failed]
My solution:
/Usr/local/mysql/data/rekfan. the pid file does not have the write permission. Solution: grant the permission to execute "chown-R mysql: mysql/var/data "" chmod-R 755/usr/local/mysql/data "and restart mysqld!
Some possible solutions provided on the Internet are as follows:
1. it may be/usr/local/mysql/data/rekfan. the pid file does not have the write permission. Solution: grant the permission to execute "chown-R mysql: mysql/var/data "" chmod-R 755/usr/local/mysql/data "and restart mysqld!
2. the mysql process may already exist in the process. Run the "ps-ef | grep mysqld" command to check whether the mysqld process exists. If the "kill-9 process number" is used to kill the process, then restart mysqld!
3. It may be the second time that mysql is installed on the machine. Residual data affects service startup. Solution: Go to the mysql data DIRECTORY/data to see, if there is a mysql-bin.index, just remove it, it is the culprit. I am using the third solution!
4. mysql uses/etc/my when the configuration file is not specified at startup. cnf configuration file. Open this file to see if there is any specified datadir in [mysqld ). Solution: Set this line in [mysqld]: datadir =/usr/local/mysql/data
5. Solution to the skip-federated field problem: Check whether the skip-federated field has been commented out in the/etc/my. cnf file. If so, comment out the field immediately.
6. The error log directory does not exist. Solution: use the "chown" and "chmod" command to grant the mysql owner and permissions.
7. selinux. If it is a centos system, selinux is enabled by default. Solution: Disable it and enable/etc/selinux/config, change SELINUX = enforcing to SELINUX = disabled and then save the disk and restart the machine.