Inserting Data from a text file to MySQL Table

  • Each column must be tab separated
  • Each row must be a new line
  • Total number of columns in file should be equal to total number of columns in text file to avoid ambiguity

Step 1: Copy the file to local folder of MySQL Machine (root) folder)

Step 2:  Run following command on MySQL interface:

load data local infile “filename” into table data_table; 

Reference: http://forums.mysql.com/read.php?10,155114,155141

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: