Brian
Brian

Reputation: 27392

Export MySQL to CSV using UNIX

Is it possible to Export a MySQL to a CSV using the command line in UNIX?

Upvotes: 2

Views: 876

Answers (2)

Seamus Abshere
Seamus Abshere

Reputation: 8516

If you have Ruby, you can use the mysql2xxxx gem

gem install mysql2xxxx
mysql2csv --username=root --password=password --execute "select * from mytable" > mytable.csv

It's not as fast as mysqldump, but you don't need to be on the same computer as the MySQL server. It also provides mysql2xml and mysql2json.

Upvotes: 1

Related Questions