Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jserviceorg/7af7915515ec9840123e78a14198aaa3 to your computer and use it in GitHub Desktop.
Save jserviceorg/7af7915515ec9840123e78a14198aaa3 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