PHP Uncategorized

How to Convert all Mysql Tables to InnoDB Script


<?php // Connect to database // ... // Get all databases $Result = @mysql_query(&#x22;show databases&#x22;); $cnt = @mysql_num_rows($Result);
 while ($cnt) { $cnt--;
 if (!($Row = @mysql_fetch_array($Result))) {
 continue;

 } 
$database = $Row[0]; 
if (Strcasecmp($database,&#x27;information_schema&#x27;)==0) continue;
 echo &#x22;+ Converting [$database]rn&#x22;; 
flush(); 
// Select database if (!@mysql_select_db($database)) continue;
 // Iterate through all tables converting them one by one $Result1 = @mysql_query(&#x22;SHOW TABLES FROM $database&#x22;); 
$cnt1 = @mysql_num_rows($Result1); 
while ($cnt1) { $cnt1--; if (!($Row1 = @mysql_fetch_array($Result1))) { continue;
 } $tablename = $Row1[0]; @mysql_query(&#x22;alter table $database.$tablename engine=innodb&#x22;);
 } } ?&#x3E;