mysqldump command for csv file

0
Your rating: None

The following command create two files in /tmp folder mytable.sql and mytable.txt. The sql file have the table creation schema and the txt file have the records of the mytable table with comma delimited fields.

$mysqldump -u user -p --fields-terminated-by=',' --tab=/tmp mydatabase mytable

NOTE: --tab option works only if the mysql client and the mysql server are running on the same machine.

Omitting the 'mytable' part in the above command will export all tables in the database, one table per file

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.

Cumulus Tag Cloud

Kiran Says

I love work environment which is:

Informal yet professional
Demanding yet rewarding
Challenging yet inspiring
Mediocrity is not an option
Having fun is serious business
Making mistakes is human
Forgiveness is Company Policy

Travelling Sucks