快捷搜索: 王者荣耀 脱发

Table was not locked with LOCK TABLES

>mysqldump -hlocalhost -P3307 -uroot -p123456 mydb mytable --where="id = 412123456 and id in (select * from table2)" --hex-blob --add-drop-table=false --add-locks=false --no-create-info=true>"d:export.sql"

执行这条导出语句时出现提示:Table ‘table2’was not locked with LOCK TABLES(1100)

究其原因,是因为该语句使用了两张表mytable 和 table2,而指令db参数后面只提供了一张表,导致无法锁表:A session that requires locks must acquire all the locks that it needs in a single LOCK TABLES statement.

解决方案就是在表参数中列出所有设计到的表

mysqldump -hlocalhost -P3307 -uroot -p123456 mydb mytable table2 --where="id = 412123456 and id in (select * from table2)" --hex-blob --add-drop-table=false --add-locks=false --no-create-info=true>"d:export.sql"

>mysqldump -hlocalhost -P3307 -uroot -p123456 mydb mytable --where="id = 412123456 and id in (select * from table2)" --hex-blob --add-drop-table=false --add-locks=false --no-create-info=true>"d:export.sql" 执行这条导出语句时出现提示:Table ‘table2’was not locked with LOCK TABLES(1100) 究其原因,是因为该语句使用了两张表mytable 和 table2,而指令db参数后面只提供了一张表,导致无法锁表:A session that requires locks must acquire all the locks that it needs in a single LOCK TABLES statement. 解决方案就是在表参数中列出所有设计到的表 mysqldump -hlocalhost -P3307 -uroot -p123456 mydb mytable table2 --where="id = 412123456 and id in (select * from table2)" --hex-blob --add-drop-table=false --add-locks=false --no-create-info=true>"d:export.sql"
经验分享 程序员 微信小程序 职场和发展