簡體   English   中英

無法找出此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; ,並刪除所有分號,則返回一個稍微相似的錯誤:

 #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

我不知道為什么會這樣。 任何幫助表示贊賞。 謝謝。

您可能需要開始:create DEFINER = root @ localhost ...
另外,由於這是單線,所以您不需要BEGIN..END

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM