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 权限没有被用到