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

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
6 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.