Convert MySQL Storage Engine of Tables from InnoDB to MyISAM
I needed to disable InnoDB support on my tiny server to save memory. To achieve this, I first had to convert the storage engine of all tables in all databases.
echo "show databases;" | mysql -uroot -p[your password] | grep -v "Database" | grep -v "information_schema" | grep -v "test" | grep -v "mysql" | grep -v "performance_schema" > mysql-dbs.txt
input=mysql-dbs.txt
while read DB
do
TABLES=$(mysql -p[your password] -uroot --skip-column-names -B -D $DB -e 'show tables')
for T in $TABLES
do
mysql -p[your password] -uroot -D $DB -e "ALTER TABLE $T ENGINE=MYISAM"
done
done < "$input"
After doing this, we can safely add the following option to our /etc/mysql/my.cnf :
skip-innodb
Add new comment