MySQL命令行问题

时间:2018-06-18 20:08:08

标签: mysql command-line-interface

我正在尝试创建一个mysql cron作业,将数据库表从昨天导出为csv

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(date_created) = DATETIME(NOW() - INTERVAL 1 DAY)' at line 1

mysql -u db_user -pPASSWORD -h 00.00.00.00 db_name -B -e "select * FROM emailsignup_signup WHERE DATETIME(date_created) = DATETIME(NOW() - INTERVAL 1 DAY);" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > /var/www/subscribers/subscribers+date+"%Y%m%d_%H%M%S".csv

我尝试在变量周围添加括号,并转义括号。 我根本无法弄清楚我做错了什么来得到这个错误

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(date_created) = DATETIME(NOW() - INTERVAL 1 DAY)' at line 1

0 个答案:

没有答案