Created
July 25, 2019 13:40
-
-
Save samyranavela/4cdd9c1c2278973b2587d8f132ce7220 to your computer and use it in GitHub Desktop.
Rename a Database in MySQL
This file contains 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
mysql -u dbUsername -p"dbPassword" oldDatabase -sNe 'show tables' | while read table; do mysql -u dbUsername -p"dbPassword" -sNe "RENAME TABLE oldDatabase.$table TO newDatabase.$table"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment