2026年11月12日

2026年11月12日

InnoDB vs MyISAM in WordPress: Check Engines and Convert to InnoDB

This article is a localized edition of the Japanese original. Read the Japanese original

MySQL and MariaDB let you choose a "storage engine", the way data is stored, for each table. The two that come up most with WordPress are InnoDB and MyISAM. Sites built on older servers, or moved from an old database, may still have MyISAM tables. This article explains the differences and how to convert tables to InnoDB. It was checked against the official MySQL 8.4 manual and WordPress.org as of November 2026.

How InnoDB and MyISAM differ

Item InnoDB MyISAM
Status in current MySQL Default engine (MySQL 5.5 and later) Legacy engine. There is little reason to use it for new tables
Transactions Yes (COMMIT, ROLLBACK) No
Locking Row-level. Other rows can be read and written while one is being written Table-level. The whole table waits while a write is in progress
Recovery after a crash Recovers automatically using its logs Tables can be corrupted and need repair
Foreign keys Supported Not supported
Full-text search (FULLTEXT) Supported since MySQL 5.6 Supported
Disk usage More than MyISAM Less

On a site like WordPress, where posts, comments, options and sessions are written at the same time, MyISAM's table-level locking causes waits as traffic grows. InnoDB is also the better fit because its tables are less likely to be corrupted when the server stops suddenly.

WordPress core does not specify an engine when it creates tables; it uses the database's default engine. WordPress.org recommends MySQL 8.0 or later or MariaDB 10.11 or later, and both default to InnoDB. A site created today normally has only InnoDB tables.

1. Check the current engines

Run the following in the "SQL" tab of phpMyAdmin or with the mysql command. Replace your_db_name with the value of DB_NAME in wp-config.php.

SELECT TABLE_NAME, ENGINE
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'your_db_name'
ORDER BY ENGINE, TABLE_NAME;

To see only the number of tables per engine, use this:

SELECT ENGINE, COUNT(*) AS tables
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'your_db_name'
GROUP BY ENGINE;

If you have SSH and WP-CLI, you can run the following in the WordPress folder. wp db query uses the connection details in wp-config.php, so you don't have to type a password.

wp db query "SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY ENGINE;"

In phpMyAdmin you can also see the engine in the "Type" column of the table list when you select the database. SHOW TABLES; only shows table names, so it cannot be used to check engines.

2. Prepare before converting

  • Take a backup: Export the whole database. See How to back up the WordPress database for the steps.
  • Check free disk space: ALTER TABLE rebuilds the table, so during the conversion you need room for both the old and the new table. InnoDB uses more space than MyISAM.
  • Do it when traffic is low: Writes to a table wait while it is being converted. Large tables (such as wp_posts, wp_postmeta and wp_comments on sites with many posts or comments) take time.
  • On shared hosting: Some hosts don't allow changing the engine. If you get an error, check your hosting company's documentation.

3. Convert one table to InnoDB

ALTER TABLE wp_posts ENGINE=InnoDB;

The wp_ in the table name is the value of $table_prefix in wp-config.php. If you use a different prefix, adjust the name.

4. Convert all MyISAM tables at once

If you have many tables, generate the conversion statements with SQL first and then run them. The SQL below lists ALTER TABLE statements for only the MyISAM tables in the given database.

SELECT CONCAT('ALTER TABLE `', TABLE_NAME, '` ENGINE=InnoDB;') AS sql_to_run
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'your_db_name'
  AND ENGINE = 'MyISAM';

This SQL only displays the statements; it does not convert anything. Copy the statements shown and run them as SQL. Running them one at a time makes it easier to see which table failed.

If you have WP-CLI, you can also convert them one after another from the shell like this:

for t in $(wp db query "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() AND ENGINE = 'MyISAM';" --skip-column-names); do
  echo "converting $t"
  wp db query "ALTER TABLE \`$t\` ENGINE=InnoDB;"
done

5. Check after converting

Run the SQL from step 1 again and confirm that no MyISAM tables remain. Then check the following:

  • The site displays, and you can log in, save posts and post comments
  • No errors appear on the screens of the plugins you use

Some tables created by plugins may have been designed with MyISAM in mind. If a plugin misbehaves after the conversion, check that plugin's documentation or its developer's guidance.

Review the server settings too (VPS or dedicated server)

Once no MyISAM tables are left, you can tune MySQL for InnoDB. The official MySQL manual gives the following guidance:

  • key_buffer_size, the cache for MyISAM, can be made smaller
  • Increase innodb_buffer_pool_size, where InnoDB keeps data and indexes in memory (50 to 75 percent of system memory is given as a guideline when converting from MyISAM; if the database runs on the same machine as the web server, leave memory for PHP and other processes)

Detailed tuning is covered in How to optimize MySQL InnoDB. These settings cannot be changed on shared hosting.

Questions about WordPress? The publisher of this site is based in Japan and replies in Japanese. Contact (Japanese)

お気軽にご相談ください

お見積りへ お問い合わせへ
▲