Created
January 20, 2013 00:49
-
-
Save budda/4576064 to your computer and use it in GitHub Desktop.
A nice snippet to generate the SQL statements to move each individual table over to a new database - aka database renaming for MySQL. $1 and $2 are source and target respectively
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT concat('RENAME TABLE $1.',table_name, ' TO $2.',table_name, ';') | |
FROM information_schema.TABLES | |
WHERE table_schema='$1'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment