Creative, Informative and Entertaining Stuff for everyone

Monday February 6th 2012

Categories

Archives

Calender

February 2012
S M T W T F S
« Dec    
 1234
567891011
12131415161718
19202122232425
26272829  

How to import data into mysql db from sql file

Bookmark and Share

Open your shell prompt

navigate to the mysql directory (default is /var/lib/mysql)
cd /pathToYourMysqlDirectory/

then type the below command

$ mysql -u mysqlUserName -p Password -h HostName DatabaseName < /loactionOfYourSqlFile/yourSqlFileName.sql

Where
mysqlUserName = Mysql User Name
Password = Mysql User Password
HostName = Mysql Host Name (This could be local host or some remote IP where you want to import the database)
DatabaseName = Mysql Database Name
/loactionOfYourSqlFile/yourSqlFileName.sql = This is the location of your sql file

Note : This is work only in Linux system

Thanks

Leave a Reply