amh9412
amh9412

Reputation: 79

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

Upvotes: 0

Views: 2038

Answers (1)

Bhanu Sengar
Bhanu Sengar

Reputation: 382

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

Upvotes: 0

Related Questions