delimiter $$ create trigger trg_delete_on_users before DELETE on users for each row begin delete from authorities where username = old.username ; delete from user_action where user_name = old.username ; end $$ delimiter ;
開頭要使用的 delimiter $$ 來定義$$爲分隔符,在末尾再把分隔符恢復爲分號。不然,解釋器遇到分號,就認爲你SQL完結了,而後就報語法錯了,坑爹不??spa