[MYSQL]MySQL 쿼리 결과를 파일로 저장하기(shell)

2020. 7. 13. 17:48 Database/mysql

#!/bin/sh


mysql -utest -ptest webzine -e "select trim(email) as email, reject_time from webzine.rejection where DATE_FORMAT(reject_time,'%Y-%m-%d') = DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY),'%Y-%m-%d')" -t > /data/NFS/newsletter_deny/rejection.txt


폴더권한 : chmod 777



출처: https://applejara.tistory.com/549 [애플자라]