Change all MyISAM tables to InnoDB from shell

A very handy command to change all MyISAM tables for specific database to InnoDB.

Just put correct database name instead of dbName .

mysql -u root -p dbName -e \
 "show table status where Engine='MyISAM';" | awk \
 'NR>1 {print "ALTER TABLE "$1" ENGINE = InnoDB;"}'  | \
  mysql -u root -p dbName