Refresh & clone the Database in MySQL Database with MySQLDUMP

Refresh / clone the Database in MySQL Database

Suppose i want to clone the tables of TEST1 database/Schema to TEST2 Schema then
Following steps involved in cloning the database:
1. Take backup from MySQLDUMP utility.
2. Create the Second database.
3. Import the dump into the Second Database.
4. Verified the objects.

1. Take backup of Test1 database with MySQLDUMP utility.

Backup of TEST DB
C:\Program Files\MySQL\MySQL Server 8.0\bin>mysqldump -u root -p test1 > D:\test1dump.sql
Enter password: *****

2. Create the second database.

mysql> create database test2;
Query OK, 1 row affected (0.25 sec)

3. Import the dump into TEST2 database.

C:\Program Files\MySQL\MySQL Server 8.0\bin>mysql -u root -p test2 < D:\test1dump.sql
Enter password: *****

4. Verified from MySQL

mysql> use test2;
mysql> show tables;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.