When the mysql database storage engine is MyISAM, data tables may be locked in the case of large traffic volumes, which may cause users to return 502 when they connect to the website, in this case, you need to convert the MySQL database MyISAM storage engine to Innodb.
The procedure is as follows:
1,Export the table structure of the CentOS Database
Copy codeThe Code is as follows: mysqldump-d-uxxx-p centos> centos_table. SQL
The-d parameter indicates that no data is exported, and only the table structure is exported.
2,Replace MyISAM in centos_table. SQL with INNODB
Copy codeThe Code is as follows: sed-I's/MyISAM/INNODB/G' centos_table. SQL
3,Create a database centos_new and import the table structure
Copy codeThe Code is as follows: mysql> create database centos_new;
Mysql-uroot-p centos_new <centos_table. SQL
You can use show table status to check whether the engine is INNODB.
4,Export centos data
Copy codeThe Code is as follows: mysqldump-t-uroot-p centos> centos_data. SQL
The-t parameter indicates that only data is imported, and the table structure is not imported.
5,Import data to centos_new
Copy codeThe Code is as follows: mysql-uroot-p centos_new <centos_data. SQL