2Fast2BCn
New member
- Joined
- May 27, 2016
- Messages
- 10
- Points
- 0
Normally when you create one table in MySQL Storage Engine, you will have many styles to choose from. Including 3 types of storage that most use are InnoDB, MyISAM and Memory.
If for any reasons you need to change the type from MyISAM to InnoDB or vice versa. PHP will help you do that.
Now your task is change the parameters such as $dbhost, $dbuser, $dbpass, $dbname to match the information on your hosting.
Hope to hear other ways from all of you here.
If for any reasons you need to change the type from MyISAM to InnoDB or vice versa. PHP will help you do that.
Code:
<?php
// connect your database here first
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'root';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'databasename';
mysql_select_db($dbname);
// Actual code starts here
$sql = "SHOW tables";
$rs = mysql_query($sql);
while($row = mysql_fetch_array($rs))
{
$tbl = $row[0];
$sql = "ALTER TABLE $tbl ENGINE=INNODB";
mysql_query($sql);
}
?>
Hope to hear other ways from all of you here.