Restore a Database

If the backup file contains: CREATE DATABASE IF NOT EXISTS, it may be possible to do a quick restore from the command line:

d@workstation:~$ mysql -u root -pSecret < backup.sql



Otherwise, it will be necessary to ensure the target (empty) database exists, to receive the content:

mysql> create database myRestore ;
Query OK, 1 row affected (0.00 sec)



After quiting the MySQL monitor, use the command line to restore the database:

d@workstation:~$ mysql -u root -pSecret myRestore < backup.sql

Leave a Reply