PDA

View Full Version : Copy SQL Database



Techgy
09-10-2007, 10:56 PM
I need to make a copy of an existing SQL database (db1) and duplicate the structure and contents in another database (db2). What's the best approach to do this?

I thought about doing a backup of db1 using the cpanel backup utility then do a restoral but that would just put it back into db1. If I renamed the *.gz file that's the backup to reflect the name db2 and then did a restoral would that work?

I need to be careful so I don't screw up db1 as it's supporting an existing site.

r2b2
09-10-2007, 10:59 PM
Depending on how big the database is, just go to phpMyAdmin and do an Export. If you export it as SQL type statements then you can just go into a text editor and change db1 to db2....