The database can only be started by restarting. After checking, it was found that the memory is full. In addition, the database memory is allocated too much.
There are many possible reasons for the problem. The best way to determine the specific reason is to check the error log first: 1. It may be that the /usr/local/mysql/data/mysql.pid file does not have write permissions Solution: Give permissions, execute "chown -R mysql:mysql /var/data" "chmod -R 755 /usr/local/mysql/data" and 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 number" to kill it, and then restart mysqld!
3. It may be the second time that mysql is installed 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 see if there is a specified data directory (datadir) 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 an uncommented skip-federated field in the /etc/my.cnf file. If there is, comment it out immediately.
6. The error log directory does not exist Solution: Use the "chown" "chmod" command to give mysql owner and permissions
7. 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.
On your side, innodb_pool_buffer_size is too large, and your server memory is too small, causing the system to oom. It is recommended to reduce this value and increase the server memory configuration.
The database can only be started by restarting. After checking, it was found that the memory is full. In addition, the database memory is allocated too much.
There are many possible reasons for the problem. The best way to determine the specific reason is to check the error log first:
1. It may be that the /usr/local/mysql/data/mysql.pid file does not have write permissions
Solution: Give permissions, execute "chown -R mysql:mysql /var/data" "chmod -R 755 /usr/local/mysql/data" and 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 number" to kill it, and then restart mysqld!
3. It may be the second time that mysql is installed 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 see if there is a specified data directory (datadir) 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 an uncommented skip-federated field in the /etc/my.cnf file. If there is, comment it out immediately.
6. The error log directory does not exist
Solution: Use the "chown" "chmod" command to give mysql owner and permissions
7. 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.
You can try the 7th method~~~On your side, innodb_pool_buffer_size is too large, and your server memory is too small, causing the system to oom. It is recommended to reduce this value and increase the server memory configuration.