简体   繁体   中英

Mysql restore from backup file

I made a backup from a database in mysql with the command mysqldump -u root -p Test > test.sql and it saved correctly the database in the file, but when I restore it in a different database with the command mysql -u root -p Test2 < test.sql after create the new and clean Test2 database, it restore the originally backed up Test database and not the one that I want, if someone could tell me how can I change this behavior or what am I doing wrong, I'll appreciate it. Thanks

Please follow this code.

Step 1:

mysql -u <user> -p < db_backup.dump

Step 2

USE <database-name-here>;

I hope it will help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM