Skip to content

Instantly share code, notes, and snippets.

@ablyler
Created December 21, 2011 23:08
Show Gist options
  • Save ablyler/1508126 to your computer and use it in GitHub Desktop.
Save ablyler/1508126 to your computer and use it in GitHub Desktop.
Convert all MyISAM tables in all databases on a server to InnoDB
#!/bin/bash
for t in $(mysql --batch --column-names=false -e "select concat(TABLE_SCHEMA, '.', TABLE_NAME) from INFORMATION_SCHEMA.TABLES where ENGINE = 'MyISAM' and TABLE_TYPE = 'BASE TABLE' and TABLE_SCHEMA <> 'mysql'" mysql); do
mysql -e "alter table $t type=InnoDB";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment