Link to home
Start Free TrialLog in
Avatar of Richard Korts
Richard KortsFlag for United States of America

asked on

Make copy of Database

If I want to make an exact copy of a MySQL database from one place to another, can I just export all the tables (in sql format), save to my local machine, create a new databae on a different place & just import all the content from the exported file (or files)?
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Not sure which version of MySQL you are using, but see the following link for a full explanation: https://dev.mysql.com/doc/refman/5.7/en/mysqldump-copying-database.html.

Log on to your MySQL shell from the command line and execute the following commands:
mysqldump db1 > dump.sql
mysqladmin create db2
mysql db2 < dump.sql

Open in new window


Substitute "db1" and "db2" with whatever names are appropriate.