← All recipes

Convert MyISAM database tables to InnoDB

Finds and converts any database tables using MyISAM storage engine to InnoDB.

output=$( wp db query "SELECT COUNT(*) FROM information_schema.TABLES WHERE ENGINE = 'MyISAM'" --skip-column-names )
if [[ "$output" -gt "0" ]]; then
	echo "Found $output MyISAM tables"
	wp db query "SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA,'.', TABLE_NAME, ' ENGINE=InnoDB;') FROM information_schema.TABLES WHERE ENGINE = 'MyISAM'" --skip-column-names > db_optimize.sql
	wp db query < db_optimize.sql
	rm db_optimize.sql
fi
Run it across a fleet

Open the console in CaptainCore Manager, pick the target sites, choose this recipe from the Cookbook picker and press run. The CLI streams each site's output back to the dock.

About the console →