Restore MySQL database from a backup file

By Lowell Heddings on September 11th, 2006

There are many reasons you would want to restore a database from a backup file… But you should also test this on a test server just to make sure that your database backups are working correctly. Here’s the syntax:

mysql -h hostname -u username -pthepassword databasename < dumpfile.sql

Here’s an example:

mysql -h localhost -u root -p72aDufi8 db01 < thedumpfile.sql

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 09/11/06
More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!