MySQL - How to restore a MySQL database from a dump file?
Using mysqldump:
If you restore only one database:
mysql -u user_name -p db_name < db_backup.dump
If the database already does not exist yet, you have to create the db first:
$ mysql -u user_name -p
mysql> create database db_name;
mysql> use db_name;
mysql> source db_backup.dump;
If you restore multiple databases:
mysql -u user_name -p < db_backup.dump
Using TablePlus GUI tool for MySQL:
- From the welcome screen, choose
restore
- Choose your connection
- Choose an existing database or choose to create a new one
- Hit
Start restore
- Choose the dump file and start restoring
All done!
Need a good GUI Tool for MySQL? TablePlus is a modern, native tool with an elegant UI that allows you to simultaneously manage multiple databases such as MySQL, PostgreSQL, SQLite, Microsoft SQL Server and more.
Download TablePlus here, it’s free anw!.