BUG:mysql 5.6 Invalid use of GRANT/REVOKE command breaks replication

bug描述:当使用revoke,grant命令收回,授予权限出错时(语法错误除外),会导致主从同步异常终止。如:

mysql> revoke select on *.* from aaa;

ERROR 1141 (42000): There is no such grant defined for user ‘aaa‘ on host ‘%‘     该用户没有该权限却执行了回收该权限

mysql> GRANT FILE ON test.* TO [email protected];

ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES   错误授权等

影响版本:mysql 5.6~5.6.13

场景重现:

master:

mysql> insert into a values(1);

Query OK, 1 row affected (0.00 sec)

mysql> GRANT FILE ON test.* TO [email protected];

ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES

mysql> insert into a values(2);

Query OK, 1 row affected (0.00 sec)

mysql> insert into a values(3);

Query OK, 1 row affected (0.00 sec)

slave:

mysql> show slave status\G

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: 172.16.0.44

Master_User: rpladmin

Master_Port: 3306

Connect_Retry: 10

Master_Log_File: online044-bin.000013

Read_Master_Log_Pos: 307

Relay_Log_File: online045-relay-bin.000028

Relay_Log_Pos: 474

Relay_Master_Log_File: online044-bin.000012

Slave_IO_Running: Yes

Slave_SQL_Running: No

Replicate_Do_DB:

Replicate_Ignore_DB:

Replicate_Do_Table:

Replicate_Ignore_Table:

Replicate_Wild_Do_Table:

Replicate_Wild_Ignore_Table:

Last_Errno: 1590

Last_Error: The incident LOST_EVENTS occured on the master. Message: error writing to the binary log

Skip_Counter: 0

Exec_Master_Log_Pos: 307

Relay_Log_Space: 1634

Until_Condition: None

Until_Log_File:

Until_Log_Pos: 0

Master_SSL_Allowed: No

Master_SSL_CA_File:

Master_SSL_CA_Path:

Master_SSL_Cert:

Master_SSL_Cipher:

Master_SSL_Key:

Seconds_Behind_Master: NULL

Master_SSL_Verify_Server_Cert: No

Last_IO_Errno: 0

Last_IO_Error:

Last_SQL_Errno: 1590

Last_SQL_Error: The incident LOST_EVENTS occured on the master. Message: error writing to the binary log

Replicate_Ignore_Server_Ids:

Master_Server_Id: 17216044

Master_UUID: cad43e8b-97b0-11e4-a557-00505681293d

Master_Info_File: /data/mysql/master.info

SQL_Delay: 0

SQL_Remaining_Delay: NULL

Slave_SQL_Running_State:

Master_Retry_Count: 86400

Master_Bind:

Last_IO_Error_Timestamp:

Last_SQL_Error_Timestamp: 150109 14:07:55

Master_SSL_Crl:

Master_SSL_Crlpath:

Retrieved_Gtid_Set:

Executed_Gtid_Set:

Auto_Position: 0

解决方法:

mysql> stop slave;

Query OK, 0 rows affected (0.00 sec)

mysql> set global sql_slave_skip_counter=1;

Query OK, 0 rows affected (0.00 sec)

mysql> start slave;

Query OK, 0 rows affected (0.01 sec)

mysql> select * from a;

+----+

| id |

+----+

|  1 |

|  2 |

|  3 |

mysql> show slave status\G

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: 172.16.0.44

Master_User: rpladmin

Master_Port: 3306

Connect_Retry: 10

Master_Log_File: online044-bin.000012

Read_Master_Log_Pos: 120

Relay_Log_File: online045-relay-bin.000028

Relay_Log_Pos: 287

Relay_Master_Log_File: online044-bin.000012

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Replicate_Do_DB:

Replicate_Ignore_DB:

Replicate_Do_Table:

Replicate_Ignore_Table:

Replicate_Wild_Do_Table:

Replicate_Wild_Ignore_Table:

Last_Errno: 0

Last_Error:

Skip_Counter: 0

Exec_Master_Log_Pos: 120

Relay_Log_Space: 631

Until_Condition: None

Until_Log_File:

Until_Log_Pos: 0

Master_SSL_Allowed: No

Master_SSL_CA_File:

Master_SSL_CA_Path:

Master_SSL_Cert:

Master_SSL_Cipher:

Master_SSL_Key:

Seconds_Behind_Master: 0

Master_SSL_Verify_Server_Cert: No

Last_IO_Errno: 0

Last_IO_Error:

Last_SQL_Errno: 0

Last_SQL_Error:

Replicate_Ignore_Server_Ids:

Master_Server_Id: 17216044

Master_UUID: cad43e8b-97b0-11e4-a557-00505681293d

Master_Info_File: /data/mysql/master.info

SQL_Delay: 0

SQL_Remaining_Delay: NULL

Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it

Master_Retry_Count: 86400

Master_Bind:

Last_IO_Error_Timestamp:

Last_SQL_Error_Timestamp:

Master_SSL_Crl:

Master_SSL_Crlpath:

Retrieved_Gtid_Set:

Executed_Gtid_Set:

Auto_Position: 0

1 row in set (0.00 sec)

官方bug参考地址:http://bugs.mysql.com/bug.php?id=68892

时间: 2024-10-09 12:38:17

BUG:mysql 5.6 Invalid use of GRANT/REVOKE command breaks replication的相关文章

MySQL 5.7 Invalid default value for 'CREATE_TIME'报错的解决方法

出处:http://blog.itpub.net/15498/viewspace-2136006/ 由于数据库的升级,今天在执行从MySQL 5.6导出来的SQL文件时报错: mysql> source cms_user.sqlQuery OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected, 1 warning (0.04 sec) ERROR 1067 (42000): Invalid default value for 'CREA

【转】MySQL GRANT REVOKE用法

原文地址:http://chenling1018.blog.163.com/blog/static/14802542010320112355598 MySQL的权限系统围绕着两个概念: 认证->确定用户是否允许连接数据库服务器 授权->确定用户是否拥有足够的权限执行查询请求等. 如果认证不成功的话,哪么授权肯定是无法进行的. revoke 跟 grant 的语法差不多,只需要把关键字 “to” 换成 “from” 表 GRANT和REVOKE管理的权限 权限 描述 ALL PRIVILEGES

MySQL read_log_event(): 'Found invalid event in binary log'

MySQL以简单易用著称,在同一个服务器上可以安装N个不同的版本,方便测试,迁移等等.此外,对于大多数Linux系统,集成了mysql,缺省会被安装.因此多版本的问题导致一些莫名的错误也是时有发生.最近在提取binlog日志时,碰到了一个read_log_event,Found invalid event in binary log.经查发现原来是mysqlbinlog版本问题引发的.如下文,供大家参考. 1.故障描述[[email protected] bak]# mysqlbinlog --

mysql 8.0.11 中使用 grant ... identified by 时 error 1064 near 'identified by '密码'' at line 1

看一下问题图片: 1 问题: 当使用 grant 权限列表 on 数据库 to '用户名'@'访问主机' identified by '密码'; 时会出现"......near 'identified by '密码'' at line 1"这个错误 2 原因: 因为新版的的mysql版本已经将创建账户和赋予权限的方式分开了 3解决办法: 创建账户:create user '用户名'@'访问主机' identified by '密码'; 赋予权限:grant 权限列表 on 数据库 to

【错误】mysql 出现 "1067 - Invalid default value for 'UPDATE_TIME' " 错误提示的解决办法

今天工作中遇到修改表结构的时候出现错误 Invalid default value for 'UPDATE_TIME 问题原因是因为db 表中update_time的默认时间写成了 '0000-00-00 00:00:00' `update_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', 因为timestamp类型取值范围:1970-01-01 0

mysql导入时出现"ERROR at line : Unknown command '\''."的解决办法

使用mysqldump -uroot -p123456 databases > /home/databases.sql 进行备份 在使用mysql -uroot -p123456 databases  < /home/databases.sql 进行mysql恢复的时候,出现如下报错. ERROR at line 79: Unknown command '\0'. 上述错误,是因为导出时字符集的问题,解决方法如下:--default-character-set=utf8 在导入时加上mysql

[Hive - LanguageManual] Create/Drop/Grant/Revoke Roles and Privileges / Show Use

Create/Drop/Grant/Revoke Roles and Privileges Hive Default Authorization - Legacy Mode has information about these DDL statements: CREATE ROLE GRANT ROLE REVOKE ROLE GRANT privilege_type REVOKE privilege_type DROP ROLE SHOW ROLE GRANT SHOW GRANT For 

MySQL权限系统(三).权限表 Grant Tables

7.2.2 Grant Tables 授权表 The mysql system database includes several grant tables that contain information about user accounts and the privileges held by them. This section describes those tables. For information about other tables in the system databas

mysql root权限优化后没有grant权限

原先数据库里root用户授权登录主机为% mysql> show grants for [email protected]"%";                 +--------------------------------------------------------------------------------------------------------------------------------+ | Grants for [email protected