Restoring from a Backup File

To perform a restore from a file, call the mysql executable, passing it the file to restore from using the < symbol. So, to recover an entire database that you dumped using the –all-databases option.
Restoring an entire set of databases:

mysql -u user -p password < all_databases.sql or
mysql -u user -p < all_databases.sql

Restoring the publications database:

mysql -u user -p password -D publications < publications.sql or
mysql -u user -p -D publications < publications.sql

To restore a single table to a database, use a command such as that in next example where just the classics table is being restored to the publications database.

Restoring the classics table to the publications database:

mysql -u user -p password -D publications < classics.sql or
mysql -u user -p -D publications < classics.sql

Leave a Reply

Your email address will not be published. Required fields are marked *