MySQL触发器错误#2013 - 在查询期间连接到MySQL服务器 [英] MySQL Trigger Error #2013 - Lost connection to MySQL server during query
问题描述
我想创建一个MySQL触发器,当一行插入到MySQL表中时,我执行一个C ++程序。为此,我使用LIB_MYSQLUDF_SYS,我成功地安装为UDF。我的代码基于此教程。 / p>
以下是我的触发器代码:
DELIMITER @@
CREATE TRIGGER startSimulator
BEFORE INSERT ON`trigger`
FOR EACH ROW
BEGIN
DECLARE cmd CHAR(255);
DECLARE result int(10);
SET cmd = CONCAT('/ home / lab / Dropbox / simulator / version_unified /./ simulator');
SET result = sys_exec(cmd);
END;
@@
DELIMITER;
如果不清楚,系统程序将使用 ./ simulator
。但是,当我使用 INSERT INTO触发器(触发器)VALUES(是)
在触发器表中插入一行时,会出现以下错误:
#2013 - 查询期间与MySQL服务器的连接断开
删除触发器,查询执行正常。
mysqld --log-warnings = 2
/ p>
130719 15:53:59 [Note]插件FEDERATED被禁用。
mysqld:找不到文件:'./mysql/plugin.frm'(errno:13)
130719 15:53:59 [错误]无法打开mysql.plugin表。请运行mysql_upgrade来创建它。
130719 15:53:59 InnoDB:InnoDB内存堆被禁用
130719 15:53:59 InnoDB:Mutexes和rw_locks使用GCC原子内建
130719 15:53:59 InnoDB:压缩表使用zlib 1.2.3.4
130719 15:53:59 InnoDB:初始化缓冲池,大小= 128.0M
130719 15:53:59 InnoDB:完成初始化缓冲池
130719 15: 53:59 InnoDB:文件操作中的操作系统错误号13。
InnoDB:错误的意思是mysqld没有访问
InnoDB的目录。
InnoDB:文件名./ibdata1
InnoDB:文件操作调用:'open'。
InnoDB:无法继续操作。
更改
SET cmd = CONCAT('/ home / lab / Dropbox / simulator / version_unified /./ simulator');
到
SET cmd = CONCAT('/ home / lab / Dropbox / simulator / version_unified / simulator');
./用于文件在当前工作目录中。
I want to create a MySQL trigger in which I execute a C++ program when a row is inserted into a MySQL table. To do this, I am using LIB_MYSQLUDF_SYS, which I successfully installed as a UDF. My code is based off this tutorial.
Here is my trigger code:
DELIMITER @@
CREATE TRIGGER startSimulator
BEFORE INSERT ON `trigger`
FOR EACH ROW
BEGIN
DECLARE cmd CHAR(255);
DECLARE result int(10);
SET cmd=CONCAT('/home/lab/Dropbox/simulator/version_unified/./simulator');
SET result = sys_exec(cmd);
END;
@@
DELIMITER ;
In case it is unclear, the system program is executed using ./simulator
. However, when I use INSERT INTO trigger (trigger) VALUES (yes)
to insert a row into the "trigger" table, I get the following error:
#2013 - Lost connection to MySQL server during query
When I remove the trigger, the query executes fine. Does anyone have any ideas as to why this happens?
mysqld --log-warnings=2
yields:
130719 15:53:59 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
130719 15:53:59 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
130719 15:53:59 InnoDB: The InnoDB memory heap is disabled
130719 15:53:59 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130719 15:53:59 InnoDB: Compressed tables use zlib 1.2.3.4
130719 15:53:59 InnoDB: Initializing buffer pool, size = 128.0M
130719 15:53:59 InnoDB: Completed initialization of buffer pool
130719 15:53:59 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
Change
SET cmd=CONCAT('/home/lab/Dropbox/simulator/version_unified/./simulator');
to
SET cmd=CONCAT('/home/lab/Dropbox/simulator/version_unified/simulator');
./ is used when the file is in the current working directory.
这篇关于MySQL触发器错误#2013 - 在查询期间连接到MySQL服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!