Last Updated: February 25, 2016
·
5.095K
· alanthing

Convert all MyISAM tables to Aria

If you switched from MySQL to MariaDB and would like to convert your MyISAM tables to the crash-safe Aria engine, you can do it in one command:

for i in $(mysql --skip-column-names --silent -e'show databases;'|grep -Ev '(mysql|_schema|runtime)'); do mysql --skip-column-names --silent -e"SELECT table_name FROM information_schema.TABLES WHERE TABLE_SCHEMA = '$i' AND engine = 'MyISAM'" | xargs -I{} mysql -e"ALTER TABLE {} ENGINE='ARIA' TRANSACTIONAL=1;" $i; done