4

I want all my tables and the whole database to use MyISAM engine.

My Project uses MyISAM database exclusively.

I want the default table handler for all tables to be MyISAM.

3 Answers 3

11

UPDATE: InnoDB has been the default storage engine since MySQL 5.5.5. MyISAM is now legacy but still exists.

Also the default-table-type option was a synonym for default-storage-engine and was removed in MySQL 5.5. And, as of MySQL 5.6.3, default-storage-engine sets the storage engine for permanent tables only.


To see what your default storage engine currently is do: mysql> SHOW engines; MyISAM has long been the default, but someone might have changed it.

To change your default storage engine back to MyISAM, put

default-table-type=myisam

under the [mysqld] section in your my.cnf and restart mysqld.

To change existing tables back to MyISAM do:

ALTER TABLE tbl_name ENGINE=MyISAM;

Also, databases don't have storage engines, tables do. Therefore to see which engine a table is using:

SHOW CREATE TABLE tbl_name; or SHOW TABLE STATUS LIKE 'tbl_name'\G
3
  • 1
    default-storage-engine=MYISAM
    – borayeris
    Jan 10, 2015 at 19:07
  • 4
    MySQL 5.7 refuses to start with default-table-type. Changing to default-storage-engine works. The accepted answer should be updated to reflect this.
    – forthrin
    Sep 11, 2016 at 10:06
  • @forthrin Done. Thanks
    – rkulla
    Sep 12, 2016 at 21:53
1

For MySQL 5.7, add this line:

default-storage-engine=INNODB

in my.ini or my.cnf.

Official documentation here: https://dev.mysql.com/doc/refman/5.7/en/storage-engine-setting.html

This worked for me in WAMP 3.0.6 with MySQL 5.7.14, that comes with MyISAM as the default out of the box, even though the MySQL documentation states "The default engine is InnoDB in MySQL 5.7".

This is explained by WAMP developers:

"We were spending an inordinate amount of time on questions about INNODB database corruption.

This we believed was due to people using INNODB databases and not understanding that these tables are more complex. They were just closing windows and killing jobs on shutdown before MYSQL had a chance to cleanly shutdown all its databases and of course never taking a backup of databases that once corrupted were suddenly the most important thing in there lives.

So we decided to make the default database engine MYISAM as this is less likely to happen with these tables."

1
  • And you failed to see that qusetions asking to default to MyISAM not InnoDB
    – AaA
    Jun 21, 2020 at 14:20
1

MyISAM is the default storage engine. However if it is not in your case, you can do any of the following:

  1. change it using the --default-storage-engine during your MySQL server startup,
  2. by setting the default-storage-engine in the my.cnf configuration file
  3. by setting the env variable:

SET GLOBAL storage_engine = MyISAM;

SET SESSION storage_engine = MyISAM;
1
  • As you probably know by now, Mysql 5.5 default engine is Innodb
    – KCD
    Mar 25, 2012 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.