mysql> insert into test values (1);
Query OK, 1 row affected (0.02 sec)
2) In Slave instance execute flush logs:
mysql> show grants ;
+------------------------------------------------+
| Grants for test_user@localhost |
+------------------------------------------------+
| GRANT RELOAD ON *.* TO 'test_user'@'localhost' |
+------------------------------------------------+
mysql> flush logs ;
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement
Regardless of the error message, the logs are flushed by the command:
-- Terminal 1
mysql> show master status ;
+------------------+----------+--------------+------------------+-------------------------------------------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------------------------------------------------------------------------+
| mysql-bin.000006 | 726 | | | 3bc8c55f-cc7b-11e6-8186-020846607241:1-10,
42f9d661-cc7b-11e6-8175-020846607241:1-2 |
+------------------+----------+--------------+------------------+-------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
-- Terminal 2
mysql> flush logs ;
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement
-- Terminal 1
mysql> show master status ;
+------------------+----------+--------------+------------------+-------------------------------------------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------------------------------------------------------------------------+
| mysql-bin.000007 | 234 | | | 3bc8c55f-cc7b-11e6-8186-020846607241:1-10,
42f9d661-cc7b-11e6-8175-020846607241:1-2 |
+------------------+----------+--------------+------------------+-------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Description:
Flush logs command shows the following error when is executed in a slave instance in read-only for a user without super privilege:
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement
How to Repeat:
Variables for Master:
gtid-mode = ON gtid-consistenc y = ON
enforce-
Variables for Slave:
gtid-mode = ON gtid-consistenc y = ON
enforce-
log_slave_updates = ON
read_only = ON
Requirements:
A) Master/slave configuration using GTIDs.
B) User with reload privilege and without super privilege.
Procedure:
1) In Master instance create a table and insert a row on it.
mysql> create table test (col integer) ;
Query OK, 0 rows affected (0.03 sec)
mysql> insert into test values (1);
Query OK, 1 row affected (0.02 sec)
2) In Slave instance execute flush logs:
mysql> show grants ; ------- ------- ------- ------- ------- ------- + ------- ------- ------- ------- ------- ------- + @'localhost' | ------- ------- ------- ------- ------- ------- +
+------
| Grants for test_user@localhost |
+------
| GRANT RELOAD ON *.* TO 'test_user'
+------
mysql> flush logs ;
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement
Regardless of the error message, the logs are flushed by the command:
-- Terminal 1
mysql> show master status ; ------- -----+- ------- --+---- ------- ---+--- ------- ------- -+----- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ---+ ------- -----+- ------- --+---- ------- ---+--- ------- ------- -+----- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ---+ cc7b-11e6- 8186-0208466072 41:1-10, cc7b-11e6- 8175-0208466072 41:1-2 | ------- -----+- ------- --+---- ------- ---+--- ------- ------- -+----- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ---+
+------
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------
| mysql-bin.000006 | 726 | | | 3bc8c55f-
42f9d661-
+------
1 row in set (0.00 sec)
-- Terminal 2
mysql> flush logs ;
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement
-- Terminal 1
mysql> show master status ; ------- -----+- ------- --+---- ------- ---+--- ------- ------- -+----- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ---+ ------- -----+- ------- --+---- ------- ---+--- ------- ------- -+----- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ---+ cc7b-11e6- 8186-0208466072 41:1-10, cc7b-11e6- 8175-0208466072 41:1-2 | ------- -----+- ------- --+---- ------- ---+--- ------- ------- -+----- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ---+
+------
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------
| mysql-bin.000007 | 234 | | | 3bc8c55f-
42f9d661-
+------
1 row in set (0.00 sec)