Restoring your MySQL Database
To restore the database you should do two steps
create an appropriately named database on the target machine
load the file using the file using the mysql command
$ mysql -u [uname] -p[pass] [db_to_restore] < [backupfile.sql]
Now you can restore your tut_backup.sql file to the Tutorials database.
$ mysql -u root -p Tutorials < tut_backup.sql
To restore compressed backup files you can do the following:
gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname]
Restoring using PHPMyAdmin
Open phpMyAdmin
Create an appropriately named database and select it by clicking the database name in the list on the left of the screen. If you would like to rewrite the backup over an existing database then click on the database name, select all the check boxes next to the table names and select Drop to delete all existing tables in the database.
Click the SQL link. This should bring up a new screen where you can either type in SQL commands, or upload your SQL file
Use the browse button to find the database file.
Click Go button. This will upload the backup, execute the SQL commands and re-create your database.