MySQL: Mass Conversion Script for Table Engine
I'm trying to figure out how to convert开发者_开发问答 en mass from database table engine A to table engine B (in this case, from MyISAM to InnoDB). I know I can do it for individual tables using the MySQL workbench, but i'd like a script or a program that can do the conversion en mass. Anyone got any ideas?
* EDIT * I'd prefer an SQL query that I could use to do this, without using php, if possible.
In pseudo code using information_schema tables:
$rows = "SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'yourDBName'
AND ENGINE LIKE 'engineA'";
foreach ($rows as $table) {
$query = 'ALTER TABLE '.$table.' ENGINE = engineB';
}
精彩评论