开发环境
mysqldump Ver 10.17
MySQL [5.5.32-log]
问题描述
mysqldump --host="DB_HOST" --port=DB_PORT --user="DB_USER" --password="DB_PWD" -t "DB_NAME" "TBL_NAME" --where="1=1 limit OFFSET,LIMIT" > "/paht/to/storage/TBL_NAME-OFFSET-LIMIT.sql"
执行脚本的时候,提示用户没有权限锁表.
mysqldump: Got error: 1044: "Access denied for user to database ''" when doing LOCK TABLES
解决方案
在导出的语句中, 添加 --skip-opt
参数即可!
mysqldump --skip-opt --host="DB_HOST" --port=DB_PORT --user="DB_USER" --password="DB_PWD" -t "DB_NAME" "TBL_NAME" --where="1=1 limit OFFSET,LIMIT" > "/paht/to/storage/TBL_NAME-OFFSET-LIMIT.sql"