1、错误描述
1 queries executed, 0 success, 1 errors, 0 warnings
查询:insert into emp values(11,'h',23,'女')
错误代码: 1100
Table 't_depart_info' was not locked with LOCK TABLES
执行耗时 : 0 sec
传送时间 : 0 sec
总耗时 : 0 sec
2、错误原因
将emp数据库表READ锁定:LOCK TABLE emp READ;
在向emp插入数据,并调用触发器insert_data
DELIMITER $$
USE `test`$$
DROP TRIGGER /*!50032 IF EXISTS */ `insert_data`$$
CREATE
/*!50017 DEFINER = 'root'@'localhost' */
TRIGGER `insert_data` BEFORE INSERT ON `emp`
FOR EACH ROW BEGIN
INSERT INTO t_depart_info(id,depart_name,depart_teacher) VALUES(7,'hai','hugang');
END;
$$
DELIMITER ;
3、解决办法
释放锁
UNLOCK TABLES;