MySQL INTO OUTFILE override existing file?

后端 未结 7 1605
抹茶落季
抹茶落季 2020-12-05 06:19

I\'ve written a big sql script that creates a CSV file. I want to call a cronjob every night to create a fresh CSV file and have it available on the website.

Say for

相关标签:
7条回答
  • 2020-12-05 07:07

    old question.. but there is an option OVERWRITE ON that you can add to the statement

    SELECT * INTO OUTFILE '/home/sites/example.com/www/files/backup.csv'
      FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
      LINES TERMINATED BY '\n' OVERWRITE ON
    ...
    
    0 讨论(0)
提交回复
热议问题