西数超哥博客
运维经验教程分享

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

初次开始写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

转载请注明:西数超哥博客www.ysidc.top» mysqldump: Got error: 1044: Access denied for user ‘xxx’@’localhost’ when using LOCK TABLES

https://www.ysidc.top 西数超哥博客,数据库,西数超哥,虚拟主机,域名注册,域名,云服务器,云主机,云建站,ysidc.top

赞(0)
声明:本站发布的内容(图片、视频和文字)以原创、转载和分享网络内容为主,若涉及侵权请及时告知,将会在第一时间删除。本站原创内容未经允许不得转载:西数超哥博客 » mysqldump: Got error: 1044: Access denied for user ‘xxx’@’localhost’ when using LOCK TABLES

登录

找回密码

注册