mysql dump to cvs file

Issues related to applications and software problems
Blisk
Posts: 224
Joined: 2011/07/04 14:49:51
Contact:

Re: mysql dump to cvs file

Postby Blisk » 2017/09/18 11:12:41

TrevorH wrote:The important bit about the SELECT statement given is

Code: Select all

INTO OUTFILE '/var/lib/mysql-files/orders.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';' "
That tells it to a) write to the file mentioned and b) write it in CSV format. The rest of the select is up to you and uses the same syntax as any other select.


About this I know, but don't know how to include all tables into file I tried with this line but not working. Database is called wcm

Code: Select all

mysql -u root -ppass -e "wcm INTO OUTFILE '/var/lib/mysql-files/orders.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';' "

User avatar
TrevorH
Forum Moderator
Posts: 21158
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: mysql dump to cvs file

Postby TrevorH » 2017/09/18 12:22:17

It needs to be part of a SELECT statement.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke