Import & Exporting table in MySQL

To import CSV file into MySQL table from mysql command prompt (skipping the first row):

load data local infile ‘filename.csv‘ into table table_name fields terminated by ‘,’ enclosed by ‘”‘ escaped by ‘\\’ lines terminated by ‘\r\n’ ignore 1 lines (field1, field2, field3, field4, field5);

To export MySQL table into a file (with SQL insert commands) from Linux command prompt:

mysqldump -udbuser -pdbpassword –add-drop-table –add-locks –create-options –disable-keys –extended-insert –skip-lock-tables –quick –set-charset dbname table_name > filename.sql


2 thoughts on “Import & Exporting table in MySQL

  1. Hi there, I discovered your web site by way of Google whilst looking for a related topic, your website came up, it appears good. I’ve added to favourites|added to my bookmarks.

Leave a Reply

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

You are commenting using your 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