Created
September 3, 2018 13:14
-
-
Save llagerlof/ef1395571e1c4ec11aea1b49a4f617d1 to your computer and use it in GitHub Desktop.
How to duplicate a entire MySQL database to another one in the same MySQL server
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
| # Use the -p flag if needed: | |
| mysqldump -u root db_with_data | mysql -u root db_empty | |
| # If you have the error | |
| # "mysqldump: Got error: 1449: The user specified as a definer ('someuser'@'someaddress') | |
| # does not exist when using LOCK TABLES", | |
| # create the missing user: | |
| mysql> create user 'someuser'@'someaddress'; | |
| # Run the dump: | |
| mysqldump -u root db_with_data | mysql -u root db_empty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment