1 MYSQL的binlog特性,需要用户具备哪些权限?
MySQL Binlog权限需要3个权限 :
- SELECT- 缺乏SELECT权限时,报错为 
    - com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'canal'@'%' to database 'binlog'
 
- 缺乏REPLICATION SLAVE权限时,报错为 
    - java.io.IOException: Error When doing Register slave:ErrorPacket [errorNumber=1045, fieldCount=-1, message=Access denied for user 'canal'@'%'
 
- 缺乏REPLICATION CLIENT权限时,报错为 
    - com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation
 
 
- 缺乏SELECT权限时,报错为 
    
- REPLICATION SLAVE
- REPLICATION CLIENT
Binlog为什么需要这些权限?
- Select权限代表允许从表中查看数据
- Replication client权限代表允许执行- show master status,show slave status,show binary logs命令
- Replication slave权限代表允许slave主机通过此用户连接master以便建立主从 复制关系
2 查验:查验指定用户是否具有指定库/指定表的binlog权限
- Step1 Check binlog status of mysql database server
-- https://github.com/alibaba/canal/wiki/AdminGuide
show variables like 'log_bin';
show variables like 'binlog_format';

- Step2 查验指定用户是否具有指定库/指定表的binlog权限
SHOW GRANTS FOR '{userName}'@'%';

3 授予权限
GRANT 
    SELECT
    , REPLICATION SLAVE
    , REPLICATION CLIENT 
ON *.*
TO '{username}'@'%' IDENTIFIED BY '{password}'; -- % 可替换为 指定的 h


















