How to convert a MyISAM wordpress database easily

If you have an old WordPress database is possible that the engine for the MySQL/Maria tables to be MyISAM, and I don’t know if you heard but the MySQL will drop MyISAM in the future.So we know that we can use the SQL query:

ALTER TABLE table_name ENGINE=InnoDB;

So we just need the name of our tables and then do a search and replace(I used notepad++).
so we can get all the names if we use optimize tables from PHPMyAdmin, so do a select all optimize from PHPMyAdmin and then you can copy that query that looks like:

ALTER TABLE `wp_cbnetpo_ping_optimizer`, `wp_commentmeta`, `wp_comments`, `wp_links`, `wp_mts_wp_reviews`, `wp_nxs_log`, `wp_options`, `wp_pingpressfm`, `wp_postmeta`, `wp_posts`, `wp_termmeta`, `wp_terms`, `wp_term_relationships`, `wp_term_taxonomy`, `wp_usermeta`, `wp_users`, `wp_wp_rp_tags`  ENGINE=InnoDB;

Then use nodpad++ find replace feature with the following:
find

,

replace

 ENGINE=InnoDB;\n ALTER TABLE

.(watch the spaces)

Then you should end with a query good for executing and converting your tables. The query should look like this:

ALTER TABLE `wp_cbnetpo_ping_optimizer` ENGINE=InnoDB;
 ALTER TABLE `wp_commentmeta` ENGINE=InnoDB;
 ALTER TABLE `wp_comments` ENGINE=InnoDB;
 ALTER TABLE `wp_links` ENGINE=InnoDB;
 ALTER TABLE `wp_mts_wp_reviews` ENGINE=InnoDB;
 ALTER TABLE `wp_nxs_log` ENGINE=InnoDB;
 ALTER TABLE `wp_options` ENGINE=InnoDB;
 ALTER TABLE `wp_pingpressfm` ENGINE=InnoDB;
 ALTER TABLE `wp_postmeta` ENGINE=InnoDB;
 ALTER TABLE `wp_posts` ENGINE=InnoDB;
 ALTER TABLE `wp_termmeta` ENGINE=InnoDB;
 ALTER TABLE `wp_terms` ENGINE=InnoDB;
 ALTER TABLE `wp_term_relationships` ENGINE=InnoDB;
 ALTER TABLE `wp_term_taxonomy` ENGINE=InnoDB;
 ALTER TABLE `wp_usermeta` ENGINE=InnoDB;
 ALTER TABLE `wp_users` ENGINE=InnoDB;
 ALTER TABLE `wp_wp_rp_tags`  ENGINE=InnoDB;
Share the joy

Leave a Reply