Tag Archives: Clone the Schema

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;