Beta 42

Research and Development

Menu

Restore MySQL Database from Dump File

There may be situations when MySQL database gets corrupted. It is recommended to make a backup on a regular basis.

The most common backup software is mysqldump, a command-line utility used to generate a MySQL logical database backup as a single .sql file with a set of SQL statements. The utility helps you dump MySQL tables, multiple databases, or their objects. Keep in mind that it is not possible to back up MySQL databases or data to separate .sql files with the mysqldump utility.

Restore database somedb from dump file dumpfile.sql:

mysql -u muser -p somedb < ./dumpfile.sql;

You will be prompted for the user's password.

Ensure that MySQL user muser has been granted writing rights on database somedb.