Jis Mathew
Jis Mathew

Reputation: 175

Replicating tables and columns from a mysql database to another

My objective is to duplicate the tables and columns with constraints included from one database to another within a mysql server.

Is there any query possible for this purpose ?

This has to be done without copying the table data from one database to another.

Upvotes: 1

Views: 33

Answers (1)

Ranvir
Ranvir

Reputation: 191

You can achieve the same by using the two methods mentioned below:

  1. Use CREATE TABLE new_table LIKE other_db_name.other_table;

  2. You can check the create statement by SHOW CREATE TABLE and copy that statement to create a new table without copying the data.

I hope it helps!

Upvotes: 1

Related Questions