Voici un petit script PHP pour convertir vos tables de MyISAM à InnoDB:
<?php
$db = "";
$dsn = "mysql:host=mysql;dbname=$db";
$username = "";
$password = "";
$from = 'MyISAM';
$to = 'INNODB';
try {
$pdo = new PDO($dsn, $username, $password);
} catch(PDOException $e) {
die("Bad credentials");
}
$result = $pdo->query("SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = '$db' AND ENGINE = '$from'");
foreach ($result as $row) {
$success = $pdo->exec("ALTER TABLE {$row['TABLE_NAME']} ENGINE = $to");
if($success) {
echo "{$row['TABLE_NAME']} - success\\n";
} else {
$info = $pdo->errorInfo();
echo "{$row['TABLE_NAME']} - failed: $info[2]\\n";
die();
}
}
<aside> 👉 Bien entendu il faut modifier les variables du début du script ;)
</aside>