In some cases, you may need to convert the Mysql table engine in batches. The following is the PHP operation implementation & amp; lt ;? Php *** batch conversion Mysql table engine * error_reporting (E_ALL); database connection configuration $ hostlocalhost; $ usernameroot; $ passwd; $ databasetest ;...
'Innodb', 'to' => 'myisam'); mysql_engine_convert ();/*** conversion function */function mysql_engine_convert () {global $ host, $ username, $ passwd, $ configs, $ convert_rule; if ($ conn = mysql_connect ($ host, $ username, $ passwd ))! = False) {foreach ($ configs as $ db_name) {mysql_select_db ($ db_name) or exit ('not found db :'. $ db_name); $ tables = mysql_query ("show full tables"); while ($ table = mysql_fetch_row ($ tables )) {if ($ table [1] === 'view') continue; $ SQL = "show table status from {$ db_name} where Name = '{$ table [0]}'"; if ($ result = mysql_query ($ SQL )) {$ table_status = mysql_fetch_row ($ result); if (strtolower ($ table_status [1]) = strtolower ($ convert_rule ['from']) mysql_query ("alter table {$ table [0]} ENGINE = {$ convert_rule ['to']}") ;}} echo $ db_name, ': All tables ENGINE is ', $ convert_rule ['to'], "\ n" ;}} else {echo "db error \ n ";}}