mysql dump to cvs file

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

Re: mysql dump to cvs file

Post by 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
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: mysql dump to cvs file

Post by TrevorH » 2017/09/18 12:22:17

It needs to be part of a SELECT statement.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply