定义触发器:
1: USE dbtest;
2: DELIMITER ;;
3:
4: CREATE TRIGGER tr_ondel_test1 AFTER DELETE ON testtable1
5: FOR EACH ROW BEGIN
6: DELETE FROM testtable2 where testtable2.FID= OLD.ID;
7: END;;
8:
9: DELIMITER ;
删除触发器:
1: DROP TRIGGER dbtest.tr_ondel_test1;
查看触发器:
1: SHOW TRIGGERS FROM dbtest;
2:
3: SHOW TRIGGERS FROM dbtest LIKE ‘%ondel%’;
导出存储过程和触发器:
1: mysqldump -u root -p123456 --default-character-set=gbk --triggers dbtest >./bk.sql