由于用于会话的信息,我有一个需要在午夜清空的MySQL表。 我在打开全局参数后尝试创建一个MySQL事件,但是只要我想创建一个语法就会出现语法错误。 This is the error I'm getting.
CREATE EVENT delete_messages_at_midnight
ON SCHEDULE EVERY 1 DAY
STARTS CURDATE() + INTERVAL 1 DAY
DO DELETE FROM t_choices;
delimeter;
#1064 - 您的SQL语法出错;检查与您的MariaDB服务器版本对应的手册,以便在第4行的'delimeter'附近使用正确的语法
由于我是新来的并且低于10个代表我不能不幸发布图片。
答案 0 :(得分:0)
尝试在以下后删除分号:
t_choices;
然后尝试
delimiter
CREATE EVENT delete_messages_at_midnight
ON SCHEDULE EVERY 1 DAY STARTS CURDATE() + INTERVAL 1 DAY
DO DELETE FROM t_choices
delimeter ;
或者像这样:
delimiter
|
CREATE EVENT delete_messages_at_midnight
ON SCHEDULE EVERY 1 DAY STARTS CURDATE() + INTERVAL 1 DAY
DO DELETE FROM t_choices;
|
delimeter ; //Put a space between delimiter and semicolon