mysqldump: Got error: 1044: Access denied for user ‘xxx’@’localhost’ when using LOCK TABLES – 21运维
通知: .-...

mysqldump: Got error: 1044: Access denied for user ‘xxx’@’localhost’ when using LOCK TABLES

Linux异常 21运维 5643浏览 0评论

初次开始写mysql备份脚本的朋友,相信你们都遇到该报错:
mysqldump: Got error: 1044: Access denied for user ‘xxx’@’localhost to database ‘xxx’ when using LOCK TABLES
解决办法:数据库名后边添加–skip-lock-tables 

mysqldump -uxxx -p123456   –skip-lock-tables –opt $i | gzip > /home/backup/$dateDIR/data/${i}_${dateDIR}.sql.gz

分析:
mysqldump: Got error: 1044: Access denied for user ‘xxx’@’localhost’ to xxx’information_schema’ when using LOCK TABLES

那可能是你用来备份的数据库用户没有lock table的权限,可以换一个权限更高的用户,比如使用root(安全角度最好不要用这个用户,避免非服务器超管人员获取root密码),或者使用mysqldump的另一个选项:–single-transaction

mysqldump -uxxx -p123456  –default-character-set=utf8 –single-transaction –opt $i | gzip > /backup/$dateDIR/data/${i}_${dateDIR}.sql.gz

转载请注明:21运维 » mysqldump: Got error: 1044: Access denied for user ‘xxx’@’localhost’ when using LOCK TABLES

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址