Skip to content

Instantly share code, notes, and snippets.

@josephsiefers
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephsiefers/e7a30dff1ac2147f3fcc to your computer and use it in GitHub Desktop.
Save josephsiefers/e7a30dff1ac2147f3fcc to your computer and use it in GitHub Desktop.
Transfer tables from one MySQL table to another
#http://stackoverflow.com/questions/67093/how-do-i-quickly-rename-a-mysql-database-change-schema-name?page=1&tab=votes#tab-top
for table in `mysql -h $host -u root -P $port --password=$password -w -N -e "show tables from $schema"`; do
mysql -h $host -u root -P $port --password=$password -w -N -e "rename table $schema.$table to $schema_two.$table";
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment