How do I convert / change / delete more then one MySQL table?

Well, a quite simple task but still with a few dozen tables this might become quite some work in phpMyAdmin for example.

To solve this, we will use / write a simple bash script:

for t in $(mysql --batch --column-names=false -e "show tables" DBNAME);
do
mysql -e "alter table $t type=InnoDB" DBNAME;
done

That´s about it, you can replace the third line with other functions too, e.g.:
mysql -e "drop table $t" DBNAME
etc.
 
Enjoy! 

You cannot comment on this entry