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:
[code lang="SQL"] ALTER TABLE table_name ENGINE=InnoDB; [/code]
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`, `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;