MySQL INTO OUTFILE override existing file?

后端 未结 7 1633
抹茶落季
抹茶落季 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:52

    For a job like this I would place it into a bash file, delete the file

    #!/bin/bash
    rm /path/to/backup.csv
    ./backup_sql_query.sh  <<-- This contains the script to backup to CSV.
    

    The better option is to actually add a timestamp though. Disk space isn't expensive in this day and age.

提交回复
热议问题