无法创建mysql触发器

时间:2013-11-13 19:04:12

标签: mysql

每次创建触发器时,即使不使用系统表,也会出现以下错误。

ERROR 1465 (HY000): Triggers can not be created on system tables

这是我的样本测试

select * from student
    -> ;
+------------+---------+------+---------+
| name       | roll_no | dept | dept_no |
+------------+---------+------+---------+
| diya       | xxzz50  |    5 |      20 |

roll_no是主键。

当我执行

create trigger sample before delete on student for each row insert into temp values(roll_no,name);

我收到错误

ERROR 1465 (HY000): Triggers can not be created on system tables.

有人可以帮助我。我哪里错了?

1 个答案:

答案 0 :(得分:2)

我认为你试图在默认的mysql数据库中制作触发器??

您的表student所在的数据库名称是什么?也许测试?

create trigger test.sample 
   before delete on student for each row insert into temp values(roll_no,name);

或......只是......

create trigger `whatever the name of your database is..?`.`sample` 
   before delete on student for each row insert into temp values(roll_no,name);