Error code: 1100 Table 't_ depart_info 'was not locked with lock tables, tableoftables
Analyze the cause of error code generation step by step. Be patient.
Step 1: Error description
1 queries executed, 0 success, 1 errors, 0 warnings query: insert into emp values (11, 'h', 23, 'female ') error code: 1100 Table 't_ depart_info 'was not locked with lock tables execution time: 0 sec Transfer Time: 0 sec total time consumed: 0 sec
Step 2: Cause of error
LOCK the emp database table read: lock table emp READ;
Insert data into emp and call the trigger 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 ;
Step 3: solution (very simple)
Release lockUnlock tables;
In fact, when encountering error code, we should follow the above three steps to solve the problem, and be good at discovering and solving the problem.