MYSQL - 无法创建事件调度程序

时间:2017-11-23 05:05:59

标签: mysql

我使用MYSQL maria DB并运行脚本

CREATE EVENT 'delete_expire_sku_permonth'
ON SCHEDULE EVERY 1 MONTH STARTS '2017-11-23 00:00:00'
DO BEGIN
    DELETE FROM tablestok WHERE system_update < DATE_SUB(NOW(), INTERVAL 30 DAY
END

并有错误

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''delete_expire_sku_permonth'
ON SCHEDULE EVERY 1 MONTH STARTS '2017-11-23 00:00' at line 1

正确答案是什么?

1 个答案:

答案 0 :(得分:0)

我认为这是因为您在此行CREATE EVENT'delete_expire_sku_permonth'中添加了单引号。如果没有单引号,请尝试运行相同的内容。