Home > Database > Mysql Tutorial > body text

解决MySQL Replication出错一例

WBOY
Release: 2016-06-07 16:07:09
Original
1078 people have browsed it

运行环境: 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 权限没有被用到。


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!