Forum Moderators: open

Message Too Old, No Replies

Creating databases from a backup

using the .conf and .sql files to duplicate online databases

         

Drunk N Japan

6:14 pm on Jan 28, 2008 (gmt 0)

10+ Year Member



I am trying to duplicate the databases that we are using for our live sites on a test server and I have run into a small issue. I have a backup of the site in question which includes a .conf and .sql file for each of the MySQL databases. Ideally I would like to take these files and use them to recreate the live data bases. Is this feasible? Am I just chasing moonbeams?

physics

4:44 am on Jan 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This should be possible. If it's MySQL then what you'll want to do is install the same version of MySQL on the test box and put the same .conf file in the config area.

Then do the following:

On the production system:


mysqldump --opt -u uname -p pass the_database > the_database.sql

The --opt is important here.

Then on the test system do:


mysql -uuname -ppass the_database < the_database.sql