mysqldump: Couldn't execute 'show table status '解决方法

时间:2022-06-23 10:08:14
执行:[root@host2 lamp]# mysqldump -F -R -E --master-data=2   -p -A --single-transaction
在控制台端出现
mysqldump: Couldn't execute 'show table status like 'v\_bid\_bad'': SELECT command denied to user ''@'%' for column 'id' in table 't_bids' (1143)
在workbench进行select * from  v_bid_bad 出现:
10:29:20   SELECT * FROM sp.v_bid_bad LIMIT 0, 50000    Error Code: 1449. The user specified as a definer ('root'@'%') does not exist      0.000 sec
 属于权限问题
修改方法有两种:
1. 增加root@%帐户和权限
grant all on *.* to 'root'@'%' identified by '00000';
2.修改view的definer
一般如是是在本机的话用:
select concat("alter DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW ",TABLE_SCHEMA,".",TABLE_NAME," as ",VIEW_DEFINITION,";") from information_schema.VIEWS whereTABLE_SCHEMA='sp'; 

再执行输出的语句。

成功解决此问题.