Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restore mysql multiple database?

Status
Not open for further replies.

weifan

IS-IT--Management
Sep 6, 2003
45
US
I have backuped my mysql database with:
mysqldump database > database-bk -p

Right now, I need to restore my data. How to do it?

TIA,

Roger
 
Thank you for you quick reply.

However, I got the error message;
ERROR 1046 at line 11: No Database Selected

Why? Where do I need to place the database names?
 
mysql -p dbname < dbname-bk

If the database doesn't exist, it needs to be created:
mysql -p -e 'create database dbname'

 
OK, I tried:
mysql -p database < database-bk

I got this message:
ERROR 1050 at line 11: Table 'Applic' already exists

How to make it automatically replace the old tables?
 
I'd suggest dropping and recreating the database to be restored before restoring it.

If you want to merge records, you can remove the "create table" statements from your backup file, but this will probably result in some kind of data irregularities. You never know where you might get duplicates, or deleted records will reappear.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top