How to clone a MySQL table, indexes, and data?
Answers
Answered by
0
This is what I've found so far.
This will copy the data and the structure, but not the indices:
create table {new_table} select * from {old_table};
This will copy the structure and indices, but not the data:
create table {new_table} like {old_table};
Answered by
1
you have different ways to do , I am given here through commend prompt :
If you need to have duplicate in same server , through putty.exe
Using mysqldump commend
mysqldump -u [uname] -p[pass] db_name > db_backup.sql
After the dump is performed, you are ready to transfer the database. notedown the path ,
Import the database to new database
Using this commend :
mysql -u root -p newdatabase < /path/to/db_backup.sql
Similar questions