mysqldump(1143)一例解决

进行mysqldump导出的时候报:mysqldump: Couldn't execute 'show table status like 'v\_edit\_new\_product\_info'': SELECT command denied to user ''@'172.21.18.13' for column 'product_code' in table 'pc_productinfo' (1143)

过程:
root@mysql-MASTER-10-10-19-11:/opt/mysql# /opt/mysql/bin/mysqldump -uroot -p --default-character-set=utf8 --skip-lock-tables --hex-blob=true -E -R --comments --databases productcenter systemcenter usercenter webcore zapdata> /opt/mysql/bak_10.10.9.1_20180918.sql
Enter password: 
mysqldump: Couldn't execute 'show table status like 'v\_edit\_new\_product\_info'': SELECT command denied to user ''@'172.21.18.13' for column 'product_code' in table 'pc_productinfo' (1143)


将pc_productinfo忽略,加上参数--ignore-table=productcenter.pc_productinfo:
root@mysql-MASTER-10-10-19-11:/opt/mysql# /opt/mysql/bin/mysqldump -uroot -p --default-character-set=utf8 --skip-lock-tables --hex-blob=true -E -R --comments --databases productcenter systemcenter usercenter webcore zapdata --ignore-table=productcenter.pc_productinfo ?> /opt/mysql/bak_10.10.9.1_20180918.sql
Enter password:?
mysqldump: Couldn't execute 'show table status like 'v\_edit\_new\_product\_info'': SELECT command denied to user ''@'172.21.18.13' for column 'product_code' in table 'pc_productinfo' (1143)

仍然报错。

暂时先不导出productcenter库:
root@mysql-MASTER-10-10-19-11:/opt/mysql# /opt/mysql/bin/mysqldump -uroot -p --default-character-set=utf8 --skip-lock-tables --hex-blob=true -E -R --comments --databases systemcenter usercenter webcore zapdata > /opt/mysql/bak_10.10.9.1_20180918.sql
Enter password: 
mysqldump: Couldn't execute 'show table status like 'v\_edit\_new\_product\_info'': SELECT command denied to user ''@'172.21.18.13' for column 'product_code' in table 'pc_productinfo' (1143)

还是不行!仔细观察报错:show table status like 'v_edit_new_product_info',进库里查了下这个是个视图;
而用户为user ''@'172.21.18.13',说明这个视图的definer已经被删了,数据库里现在不存在。

两种解决方法:
1、将被删的用户重新建上:
select definer from views where table_name='pc_productinfo';
grant select on productcenter.* to 'xxx'@'172.21.18.13';

2、更新视图的definer:
update views set definer='xxxx' where table_name='pc_productinfo';

使用了第二种方法,解决。
注意表可能也存在这种情况,具体情况具体解决。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值