Page 2 of 2

Re: mysql dump to cvs file

Posted: 2017/09/18 11:12:41
by Blisk
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';' "

Re: mysql dump to cvs file

Posted: 2017/09/18 12:22:17
by TrevorH
It needs to be part of a SELECT statement.