无法找出这个 MySQL 事件语法有什么问题
Can't find out what's wrong with this MySQL event syntax
我正在尝试创建一个 MySQL 事件,这是我正在使用的语法:
CREATE EVENT test
ON SCHEDULE AT FROM_UNIXTIME(1428005286)
DO
BEGIN
UPDATE blog_posts SET status = 'published' WHERE id = 5;
END
当我在 Node.js 上 运行 时(使用 mySQL 适配器,在 Sails.js 下),我没有错误,但不会创建事件。当我直接通过 phpMyAdmin 运行 它时,我得到:
#1064 - 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 '' at line 5
我也尝试在 END 中添加一个分号,使其成为 END;
,并删除所有分号,并且 returns 出现了一个稍微类似的错误:
#1064 - 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 'END' at line 6
我不知道为什么会这样。任何帮助表示赞赏。谢谢。
您可能需要开始:创建 DEFINER=root
@localhost
...
此外,由于这是单行代码,因此您不需要 BEGIN..END
我正在尝试创建一个 MySQL 事件,这是我正在使用的语法:
CREATE EVENT test
ON SCHEDULE AT FROM_UNIXTIME(1428005286)
DO
BEGIN
UPDATE blog_posts SET status = 'published' WHERE id = 5;
END
当我在 Node.js 上 运行 时(使用 mySQL 适配器,在 Sails.js 下),我没有错误,但不会创建事件。当我直接通过 phpMyAdmin 运行 它时,我得到:
#1064 - 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 '' at line 5
我也尝试在 END 中添加一个分号,使其成为 END;
,并删除所有分号,并且 returns 出现了一个稍微类似的错误:
#1064 - 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 'END' at line 6
我不知道为什么会这样。任何帮助表示赞赏。谢谢。
您可能需要开始:创建 DEFINER=root
@localhost
...
此外,由于这是单行代码,因此您不需要 BEGIN..END