今天在公司进行版本升级,进行mysql备份时(5.6),遇到了如下问题:

mysqldump

mysqldump  -uUSER -p  DATABASE > /dump/sqldata/xxxdata_`date +%F`_bak.sql
Enter password:
mysqldump: Got error: 1045: Access denied for user 'USER'@'localhost' (using password: YES) when using LOCK TABLES

mysqldump有一些默认为True的选项

mysqldump --help | grep -i true
and boolean options {FALSE|TRUE}  Value (after reading options)
add-drop-table                    TRUE
add-locks                         TRUE
comments                          TRUE
create-options                    TRUE
disable-keys                      TRUE
extended-insert                   TRUE
lock-tables                       TRUE
quick                             TRUE
quote-names                       TRUE
set-charset                       TRUE
dump-date                         TRUE
secure-auth                       TRUE
triggers                          TRUE
tz-utc                            TRUE

有些选项可能导致我们执行备份的用户权限不足。

解决

1、mysqldump  -uUSER -p  --skip-lock-tables DATABASE > /dump/sqldata/xxxdata_`date +%F`_bak.sql
2、用root或者再创建一个高权限用户

正当我以为万事大吉的时候

然而又报了如下错误

mysqldump: Couldn't execute 'SHOW FIELDS FROM `XXXXX`': View 'DATABASE.TABLES' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)

大致意思是:不能够执行XXX,视图引用了无效的表或列或定义器/调用者 导致视图无法正常使用。

解决

查看下视图是如何创建的
SHOW CREATE VIEW [视图],可以看到如下部分信息。

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%`......发现```DEFINDER=“root”``又是权限导致

还是用root来吧。

mysqldump: Got error: 1045: Access denied for user 'USER'@'localhost' Couldn't execute 'SHOW FIEL相关推荐

  1. 宝塔面板不能备份数据库,数据库备份大小20K,数据库备份报错mysqldump: Got error: 1045: Access denied for user 'root'@'localhost'

    宝塔面板不能备份数据库 数据库备份大小20K 备份数据库报错 mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' ...

  2. MySQL备份报错mysqldump: Got error: 1045: Access denied for user ‘root‘@‘localhost‘ (using password: YES)

    MySQL备份报错mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) ...

  3. mysql ERROR 1045 access denied for user 'root'@'localhost' using

    操作系统:WINDOWS7 系统 数据库版本:mysql 5.1 提示:mysql ERROR 1045   access denied for user 'root'@'localhost' usi ...

  4. ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)(转)

    前两天也偶尔出现这个错误,也没在意,因为我重新修改一下mysql的root密码后又可以用了,但昨天却不行,我把root密码修改以后虽然当时能用, 一旦重新进入就都不能用了,可我的密码明明没有错啊?今天 ...

  5. 解决error 1045: Access denied for user: 'root@localhost' (Using password: YES)

    转载连接:http://jianfw2009.blog.163.com/blog/static/13431366020111016112459158/ 1.先停止mysql服务 2.在mysql的目录 ...

  6. beego orm Error 1045 [ORM]2020/06/12 22:17:09 register db Ping `default`, Error 1045: Access denied

    [ORM]2020/06/12 22:17:09 register db Ping default, Error 1045: Access denied for user 'root'@'localh ...

  7. Error:1045, Access denied for user 'root'@'localhost' (using password: YES) (Phon3.6+Mysql8.1 )

    哇,闹了一个大乌龙,昨天,写了个脚本给之前移植的mysql添加数据,结果一个小问题困了我0.75天. 脚本代码如下:(期间有个小插曲,我把port="3306",报错了,但是很快排 ...

  8. mysql8.0 【1045 - Access denied for user ‘root‘@‘localhost‘(using password: YES)】报错

    在项目中连接mysql8.0出现 [1045 - Access denied for user 'root'@'localhost'(using password: YES)]报错 1.在cmd下启动 ...

  9. Mysql 1045 Access denied for user ‘root‘@‘localhost‘ (using password: YES/NO)个人解决方法 分享一下

    前言 Mysql 1045 Access denied for user 'root'@'localhost' (using password: YES/NO) 看了很多篇文章都没解决, 下面是我个人 ...

最新文章

  1. 每日一皮:临近截止日期, 产品经理就这样看着我...
  2. python 操作.mat文件
  3. 做不了爱人,我们做什么?
  4. 《研磨设计模式》chap21 解释器模式Interpreter(2)parse模型
  5. 全国职业院校技能大赛软件测试题目,我院荣获2017年全国职业院校技能大赛软件测试赛项一等奖...
  6. 【蓝桥杯嵌入式】【STM32】10_InputCaputer之输入捕获
  7. 前端改变div排序_前端面试经常问到的问题
  8. Java基础0308
  9. 信息安全等级保护工作概述
  10. python中format函数怎么样提取字符串里的字符_Python中用format函数格式化字符串的用法...
  11. IR2104驱动原理--恩智浦智能车电机驱动
  12. 至强服务器系列,2020 最新 至强 Xeon 服务器系列 CPU天梯图
  13. android金钱符号变形,使用¥(一个中文字宽)还是¥(半个中文字宽)?
  14. 23andme的申请流程和注意事项
  15. 计算机病毒结构及技术分析
  16. Flink 命令行提交参数
  17. 嵌入式_cpu微架构、互连结构与总线
  18. NOIP2020微信步数
  19. fail2ban原理与安装(centos6)
  20. 5G泡沫严重,5G用户数竟然比5G手机累计销量多近1.5亿!

热门文章

  1. union和join的粗理解,仅供参考
  2. 无限远校正显微镜 物镜的放大倍数如何计算?
  3. 毕业论文内容框架指导(程序设计类)
  4. 基于javaweb,ssm鲜花销售系统
  5. 陪父母软件 android,同在家长版app
  6. idea下载插件搜索失败
  7. qq截图功能自带图片转文字功能
  8. RK Audio HAL 音频通路设置与Codec原理
  9. STM32下载程序问题解决:Can not read memory! Disable Read Out Proyection and try.
  10. 基于spss的曲线回归(curvilinear regression)