MySQL INTO OUTFILE override existing file?

后端 未结 7 1627
抹茶落季
抹茶落季 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 06:56

    Simply escape to a shell from within mysql and execute a rm command to remove the file before you attempt to write it. For example:

    Mysql> \\! rm -f /home/sites/example.com/www/files/backup.csv
    

提交回复
热议问题