Knowledgebase
MySQL Import Command
Posted by on 08 January 2013 12:12 AM

The syntax is as follows to import the data created by mysqldump command:

 

mysql -u {DB-USER-NAME} -p {DB-NAME} < {db.file.sql}
mysql -u {DB-USER-NAME} -h {MySQL-SERVER-HOST-NAME} -p {DB-NAME} < {db.file.sql}

 

In this example import a file called chillox.sql for chilloxdb user and chillox db, enter:

 

 

$ mysql -u sales -p salesdb1 < sales.sql

 

 

If database chilloxdb does not exists, first create it and than import it as follows:

 

 

$ mysql -u root -p -e 'create database salesdb1'
$ mysql -u sales -p salesdb1 < sales.sql

(3 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).