Convert MySQL Database from MyISAM to INNODB


Installed Moodle 2.0 using shared hosting. When I logon to my Moodle site,  this is the message I am getting

"Database tables are using MyISAM database engine, it is recommended to use ACID compliant engine with full transaction support such as InnoDB."

In my previous post I mention that you can change the MyISAM database engine to InnoDB using phpMyAdmin : Convert MyISAM to INNODB using phpMyAdmin for Moodle but it will take some time to change each table one by one.

I was looking for a good solutions to convert the MYISAM engine to InnoDB very fast and I found a blog which gives very good instructions.How to Migrate Your MySQL Database from MyISAM to INNODB

Two problem I found in the above post:

1. I was not able to see the video files from work to see the full instruction

2. It shows how to import the database but not showing what are the limitations involved in when you host Moodle in shared hosting environment.

Here are the instructions how you can resolve "Database tables are using MyISAM database engine, it is recommended to use ACID compliant engine with full transaction support such as InnoDB."  message in your Moodle 2.x

 

My current Moodle site is hosted at http://www.bluehost.com and I installed Moodle using Simple Scripts.  When you install Moodle using Simple Scripts, it will create MySQL Database and User name by default.

1. Login to your control Panel. Go where it says Database and you can see MySQL Database and phpMyAdmin. 

image

2. Click on MySQL Database to your current database

MySQL Database to your current database

As you can see Moodle installation created a database and user name.  We are going to export the current database and change MyISAM to INNODB and import back to MySQL using myPHPAdmin

3. Go to phpMyAdmin and export your database

Export Database using phpMyAdmin

 

For the database name you can leave it as since it’s know the current database name and click GO

image

 

Save the file

 

Exporting Database from myPHPAdmin

 

 

4. Open your database file in any tools which you have. In my case, I am using Dreamweaver.

Click on CTRL + F  to  find and replace of "myISAM" with "INNODB" (without quotes, of course) in the SQL dump text file

 

Find-myISAM-Replace-Innodb

5. Go to the top of the sql file which you opened and enter SET AUTOCOMMIT = 0;

set-autocommit=0

 

6. Now go to the end of the file and enter  COMMIT; and save your file.

image

 

Now  are going to import this file into phpMyAdmin but before we do that we have to drop the current database.

7. Go back to phpMyAdmin, Since I am hosting my Moodle in shared hosting I don’t have any options to drop a database.  

Drop Database from myPHPAdmin

8. When I run the SQL query Drop Database “database_name” I got following error message.  Drop Database statements are disabled

 

drop-database-statement-are-disabled 

9. Only way I can drop the database is by going to Cpanel and delete the database from MySQL Admin.  Login to your control panel

Click on MySQL Databases

mysql-database-cpanel

Delete your current database

delete-database-file

10. Confirmation to delete database

 

delete-database-mysql

 

11. Now create a new database but the name should be same as the one which you deleted.  Add user to Database.

 

Create new database in MySQL

 

12. When you add user to Database and give all privileges.

Manger User Privileges

 

13. Open your myPHPAdmin and you will see your empty database and now import your modified database

Import Database  to change to INNODB

14. You can see the Database from MyISAM to INNODB are changed. 

from MyISAM to INNODB are changed

If you open your Moodle right now it should work and you wont’ see the error message any more.  This is how you can change your MyISAM to INNODB. 
It took me while to figure it and good luck

3 thoughts on “Convert MySQL Database from MyISAM to INNODB

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s