MySQL Forums
Forum List  »  MySQL Administrator

db backup and restore to another db using mysqldump
Posted by: ahmad gholi
Date: January 18, 2012 06:23AM

Hi Guys,
I have ad dump of my database using mysqldump but then when i try to restore it using the mysql command to a new database it copies the file to the database name which it was dumped from and not to the new one

for instance, lets say that we have db1 and db2

I run :
mysqldump db1 > test.sql
then i type
mysql db2 < test.sql
in this case, the test.sql is copied back to db1 and not db2

I have not mentioned the -u and other option that i use. I also create the db2 before running the command.

the way i currently do it is by copying the db folder and rename it to the new db name which duplicates the db and no need to create it manually

any helps will be appreciated

Options: ReplyQuote

Written By
db backup and restore to another db using mysqldump
January 18, 2012 06:23AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.