How to convert database storage engine from InnoDB
to MyISAM
on MySQL
?
I found so many sites which convert the storage engine of datab
to make it permanent, add to my.cnf (few locations depending on context)
/etc/my.cnf
default-storage-engine= MyISAM
for safety, output the db list with show databases;
in my case, using php for quickie..
$db = mysql_connect('localhost','someadmin','somepass');
$dbs = array();
$dbs[] = 'test';
$dbs[] = 'myImportantDb';
foreach($dbs as $v){
mysql_select_db($v);
$q = mysql_query('show tables');
$tables = array();
while($r = mysql_fetch_row($q)){
$tables[] = $r[0];
}
foreach($tables as $t){
echo "do $v.$t\n";
mysql_query('ALTER TABLE `'.$t.'` ENGINE=MyISAM;');
}
}
mysql_close($db);