If you
are moving your data to a new server, or you have removed the old
database completely you can restore it using the code below. This will
only work if the database does not already exist:
mysql - u user_name -p your_password database_name < file_name.sql
Or using our example from the previous page:
mysql - u bobbyjoe -p happy234 BobsData < BobBackup.sql
If your database already exists and you are just restoring it, try this line instead:
mysqlimport -u user_name -p your_password database_name file_name.sql
or simple way
Restoring from FILENAME.mysql is a three step process:
1.Drop the database
mysqladmin -u USERNAME -p drop DATABASE
2. Recreate the database
mysqladmin -u USERNAME -p create DATABASE
3. Import the backup data
mysql -u USERNAME -p DATABASE < FILENAME.mysql
Keywords: Restore,Mysql