龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 数据库类 > MySQL 技术 >

解决MySQL Replication出错一例

时间:2011-04-12 23:18来源:未知 作者:admin 点击:
分享到:
运行环境: 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

运行环境:

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


精彩图集

赞助商链接