在Mysql Version 5.0.77上,我运行了这个
CREATE TRIGGER ins_trap_to_memory AFTER INSERT on Table1
FOR EACH ROW
INSERT INTO Table1_Copy SELECT NEW.*;
它运行了,但是现在每当我尝试做某些事情时数据库都会断开连接:
无法查看触发器 -
mysql> SHOW TRIGGERS LIKE '%'\G
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 7
Current database: mydb
ERROR 2013 (HY000): Lost connection to MySQL server during query
无法删除问题触发器 -
mysql> DROP TRIGGER ins_trap_to_memory;
ERROR 1064 (42000): 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 '' at line 3
无法查询information_schema.TRIGGERS -
mysql> select * from information_schema.TRIGGERS;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 12
Current database: information_schema
ERROR 2013 (HY000): Lost connection to MySQL server during query
答案 0 :(得分:2)
其他类型的查询是否有效?
我认为这两者并不相关,除非Table1持续大量插入,这是服务器过载的结果。它可能只是一个间歇性的连接问题。
无论哪种方式,您都可以使用以下方式删除它:
DROP TRIGGER ins_trap_to_memory ON Table1
答案 1 :(得分:1)
能够通过转到/var/lib/mysql/mydb
并删除Table1.TRG
来消除错误的触发器。