Skip to content

Instantly share code, notes, and snippets.

@trueqap

trueqap/toinnodb.sh

Created Jul 31, 2020
Embed
What would you like to do?
WordPress MyISAM to InnoDB with CLI
#!/usr/bin/env bash
WP_TABLES=($(wp db query "SHOW TABLE STATUS WHERE Engine = 'MyISAM'" --allow-root --silent --skip-column-names | awk '{ print $1}'))
for WP_TABLES in ${WP_TABLES[@]}
do
echo "Converting ${WP_TABLES} to InnoDB"
wp db query "ALTER TABLE ${WP_TABLES} ENGINE=InnoDB" --allow-root
echo "Converted ${WP_TABLES} to InnoDB"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.