Powered by Blogger.
Sunday, April 7, 2013

Change Joomla Database Engine MyISAM to InnoDB or InnoDB to MyISAM

Sometimes you may need to change your exisiting joomla database engine changed to InnoDB or MyISAM , There are several results on the web but they are quite hard and time wasting. I found a very easy way to do it.

First create a simply php file in you website. Give it a name like dbchange.php and put the following code into it.

// connect your database here first
    $dbhost = 'localhost';
    $dbuser = 'database_username';
    $dbpass = 'database_password';

    $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
    $dbname = 'database_name';

// 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=MYISAM";

Now simply change the database host, username, password and database name values with your joomla sites database information (you can find them in configuration.php if you have forgot)
Now select the Database Engine you want to use  by simply changing the value at line 17,
If you want to change the joomla websites database from InnoDB to MyISAM , set  ENGINE=MYISAM
If you want to change your joomla websites database engine from MyISAM to InnoDB , set ENGINE=INNODB