error in your SQL syntax creating MySQL trigger

前端 未结 3 1507
生来不讨喜
生来不讨喜 2021-01-12 14:03

I try create trigger

CREATE TRIGGER `aster_users2` after
update ON `aster_users` FOR EACH ROW
BEGIN  update event set flag=1 where
id=1; END;
3条回答
  •  臣服心动
    2021-01-12 14:38

    Delimiters should be used.

    DELIMITER $$
    
    CREATE TRIGGER `aster_users2` AFTER
    UPDATE ON `aster_users` FOR EACH ROW
    BEGIN
      UPDATE event
      SET
        flag = 1
      WHERE
        id = 1;
    END$$
    
    DELIMITER ;
    

提交回复
热议问题