ERROR 1064 (42000) at line 2: You have an error in your SQL syntax; check the manual that correspond

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/LGHunter/article/details/83624526

报错:

Warning: Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 2: 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 '--tri_afterinsert_on_plan
DROP TRIGGER IF EXISTS tri_afterinsert_on_plan' at line 1

原因:没按照触发器的语法编写,编写有误。
解决:
错误,如

#tri_afterdelete_on_tag_config
DROP TRIGGER IF EXISTS tri_afterdelete_on_tag_config;
DELIMITER $
CREATE TRIGGER tri_afterdelete_on_tag_config AFTER DELETE ON tag_config FOR EACH ROW 
BEGIN
	INSERT INTO hpm_sync.tag_config(id,tag_type,tag_name,tag_type,content,tag_type_name,platform_id,state,oper) VALUES(old.id,old.tag_type,old.tag_name,old.tag_type,old.content,old.tag_type_name,old.platform_id,0,'delete');
END;
$ #这里

正确,如

#tri_afterdelete_on_tag_config
DROP TRIGGER IF EXISTS tri_afterdelete_on_tag_config;
DELIMITER $
CREATE TRIGGER tri_afterdelete_on_tag_config AFTER DELETE ON tag_config FOR EACH ROW 
BEGIN
	INSERT INTO hpm_sync.tag_config(id,tag_type,tag_name,tag_type,content,tag_type_name,platform_id,state,oper) VALUES(old.id,old.tag_type,old.tag_name,old.tag_type,old.content,old.tag_type_name,old.platform_id,0,'delete');
END$
DELIMITER ; #这里

猜你喜欢

转载自blog.csdn.net/LGHunter/article/details/83624526