本篇内容主要讲解“如何解决错误代码1100 Table 't_depart_info' was not locked with LOCK TABLES”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“如何解决错误代码1100 Table 't_depart_info' was not locked with LOCK TABLES”吧!
第一步,错误描述
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
第二步,错误原因
将emp数据库表READ锁定:LOCK TABLE emp READ;
在向emp插入数据,并调用触发器insert_data
DELIMITER $$
USE `test`$$
DROP TRIGGER `insert_data`$$
CREATE
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 ;
第三步,解决办法(很简单)
释放锁 UNLOCK TABLES;
到此,相信大家对“如何解决错误代码1100 Table 't_depart_info' was not locked with LOCK TABLES”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!