Kurinchi Blogger Scribbles …


Feb 13
2009

MySql Tip for Beginners – Import records from .csv from Command line

Last updated: February 12th, 2009

Importing a .CSV file in MySQL from command line.

When you want to import records from a .csv file into a table, follow the steps given below:

[root@localhost]$ mysql -u [username] -p [password]

[root@localhost]$ use [my_database]

[root@localhost]$ LOAD DATA LOCAL INFILE ‘userinfo.csv’ INTO TABLE [table name] FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’;

This should be the same command that get executed on windows command prompt as well.

Tags: ,

One Response to “MySql Tip for Beginners – Import records from .csv from Command line”

  1. [...] more information at kurinchilamp.kurinchilion.com LD_AddCustomAttr("AdOpt", "1"); LD_AddCustomAttr("Origin", "other"); [...]

Leave a Reply


Valid HTML 4.01 Strict  Valid HTML 4.01 Strict