我想創建一個MySQL觸發器,當一行插入到MySQL表中時,我執行一個C++程序。爲此,我使用LIB_MYSQLUDF_SYS,我成功將其安裝爲UDF。我的代碼基於this教程。MySQL觸發錯誤#2013 - 在查詢過程中丟失與MySQL服務器的連接
這裏是我的觸發代碼:
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 trigger (trigger) VALUES (yes)
插入一行進入「觸發」表中,我得到以下錯誤:
#2013 - Lost connection to MySQL server during query
當我刪除了扳機,查詢執行罰款。有沒有人有任何想法,爲什麼會發生這種情況?
mysqld --log-warnings=2
產量:
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.
什麼是操作系統?該操作系統中是否有防火牆? –