mysql

How do I set MyISAM as default table handler in MySQL?


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.


Solution

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

    Also 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, run: 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 TABLE STATUS LIKE 'tbl_name'\G