0

在 Mysql 版本 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

无法查询信息_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
4

2 回答 2

2

其他类型的查询是否有效?

在我看来,这两者似乎不太可能相关,除非 Table1 可能有大量的插入持续进行,这是服务器过载的结果。这可能只是间歇性连接问题。

无论哪种方式,您都应该能够通过以下方式删除它:

DROP TRIGGER ins_trap_to_memory ON Table1
于 2012-07-17T15:40:51.450 回答
1

能够通过去/var/lib/mysql/mydb和删除来摆脱坏触发器Table1.TRG

于 2012-07-17T15:45:27.790 回答