导出数据显示未锁表

导出最近10天注册用户登录记录时出现:

mysqldump -uroot -p123456 test login_log -w"playerid in (select playerid from tb_player where reg_time>DATE_ADD(CURDATE(),INTERVAL -10 DAY))" > login_log.sql mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM login_log WHERE playerid in (select playerid from tb_player where reg_time>DATE_ADD(CURDATE(),INTERVAL -10 DAY))': `Table 'tb_player' was not locked with LOCK TABLES (1100)`

Table 'tbplayer' was not locked with LOCK TABLES (1100) //表'tbplayer'未使用LOCK TABLES锁定(1100)

提示表未锁定,给他加个锁表就可以了

mysqldump 有一个内置的锁表参数--lock-all-tables, -x
提交请求锁定所有数据库中的所有表,以保证数据的一致性。这是一个全局读锁,并且自动关闭--single-transaction 和--lock-tables 选项。

解决

mysqldump -uroot -p123456 test login_log -x -w"playerid in (select playerid from tb_player where reg_time>DATE_ADD(CURDATE(),INTERVAL -10 DAY))" > login_log.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.
posted @ 2020-12-18 15:25  何必丶丶  阅读(134)  评论(0编辑  收藏  举报