Error DataBase-One Place all Solutions Forums Blog Glossary    Contact Us
Search  
   
Browse by Category
Error DataBase-One Place all Solutions .: DataBase .: Oracle .: How to restore Mysql database From the Command Prompt ?

How to restore Mysql database From the Command Prompt ?


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

How helpful was this article to you?

Related Articles

article How to Backup Database From the Command Prompt?
Backup Database From the Command PromptIt is...

  3-8-2008    Views: 385   
article How to restore a DHCP database on a server cluster
SYMPTOMS When you try to restore a DHCP...

(No rating)  6-4-2008    Views: 132   
article Right Click to Open Command Prompt in Directory
Here's a handy tip that I got from a...

(No rating)  3-17-2008    Views: 216   

User Comments

Add Comment
No comments have been posted.