錯誤碼:1100 Table 't_depart_info' was not locked with LOCK TABLES的解決方案,tableoftables

來源:互聯網
上載者:User

錯誤碼:1100 Table 't_depart_info' was not locked with LOCK TABLES的解決方案,tableoftables

一步步來分析錯誤碼的產生原因,大家要有耐心哦。

第一步,錯誤描述

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 /*!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 ; 

第三步,解決辦法(很簡單)

      釋放鎖    UNLOCK TABLES;

其實在遇到錯誤碼的時候,大家就按照上面這三步走,問題一定會迎刃而解的,要善於發現問題並解決問題。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.