Contact Support : +64 220 256 070

Aimvm
Blog

How to change your Mysql engine

Posted on: August 16, 2015

This tutorial will explain on how to change the database engine on Mysql.

A database engine (or storage engine) is the underlying software component that a database management system (DBMS) uses to create, read, update and delete (CRUD) data from a database.

The database engine is selected based on the type of database access by your application. There are tow engines mainly and they are.

Innodb

MYISAM

You can use the Mysql syntax to change the engine

 

ALTER TABLE `table_name` ENGINE=INNODB;

ALTER TABLE `table_name` ENGINE=INNODB;

You can use a simple PHP script to achieve this as well.

<?php

// connect your database here first

mysql_connect('host', 'user', 'pass');

$databases = mysql_query('SHOW databases');

while($db = mysql_fetch_array($databases)) {
echo "database => {$db[0]}\n";
mysql_select_db($db[0]);

$tables = mysql_query('SHOW tables');

while($tbl = mysql_fetch_array($tables)) {
echo "table => {$tbl[0]}\n";
mysql_query("ALTER TABLE {$tbl[0]} ENGINE=MyISAM");
}
}

This will change the Engine from InnoDB to MyISAM.

Search Blog