时间:2021-07-01 10:21:17 帮助过:9人阅读
运行环境: os: redhat as4 master: MySQL 4.0.23 slave : MySQL 5.0.37 slave日志中报错信息如下: 060807 11:40:17 [ERROR] While trying to obtain the list of slaves from the master 'xxx.xxx.xxx:3306', user 'rep' got the following error: 'Access
运行环境:
os: redhat as4
master: MySQL 4.0.23
slave : MySQL 5.0.37
slave日志中报错信息如下:
060807 11:40:17 [ERROR] While trying to obtain the list of
slaves from the master 'xxx.xxx.xxx:3306', user 'rep' got the
following error: 'Access denied. You need the REPLICATION SLAVE
privilege for this operation'
在master上,执行以下语句查看权限:
mysql>SHOW GRANT FOR 'rep'@'192.168.0.2'\G
*************************** 1. row ***************************
Grants for rep@192.168.0.2: GRANT SELECT, REPLICATION SLAVE ON
*.* TO 'rep'@'192.168.0.2' IDENTIFIED BY PASSWORD 'xxx'
已经授予了 REPLICAION SLAVE 权限了,怎么还会报这个错呢?
通过查看手册和源码,才知道slave需要执行一个语句来更新slave列表:
SHOW SLAVE HOSTS;
而执行这个语句则需要 REPLICAION CLIENT 权限,因此才会报错。因此,只要重新给 'rep' 帐号加上 REPLICAION CLIENT 权限就可以了。
另外,在 MySQL 4.0/4.1 等老版本中似乎不存在这样的问题,因为在这些版本中 REPLICAION CLIENT 权限没有被用到。