Mysql MyISAM Database Batch Conversion table engine for InnoDB
Recently in the process of doing things need to change the table structure to the INNODB engine format with supporting things,
The database user name, password and other information changes to your own, put in the site to run. If you want to change the InnoDB to MyISAM modify the engine= ' InnoDB ' part of the code.
<?php/** * User:yt * DATE:2016/2/25 0025 *///connection Database $host= ' localhost '; $user = ' root '; Database user name $passwd= ' root '; Password $db= ' test '; Database name $link= mysql_connect ($host, $user, $passwd), if (! $link) {die (' Connection database failed: '. mysql_error ());} mysql_select_db ($db, $link) or Die (' Open database failed '. $db. Mysql_error ()); $result =mysql_query ("SHOW TABLES") or Die (Mysql_err or ()), while ($row =mysql_fetch_row ($result)) { echo "$row [0] \ n"; mysql_query ("ALTER TABLE $row [0] engine= ' InnoDB '") or Die (Mysql_error ());} #var_dump ($result); Mysql_close ($link);
Mysql MyISAM Database Batch Conversion table engine for InnoDB