2. create a normal user with permission to select on a table
mysql -h 127.0.0.1 -P 3306 -u root test -e"
drop table if exists t;
create table t (a int) engine=innodb;
insert into t values (2);
grant select on test.t to 'a'@'%' identified by 'pwd';
"
3. select statement will be blocked if read_only was set
mysql -h 127.0.0.1 -P 3306 -u root -e "set @@global.read_only=0"
mysql -h 127.0.0.1 -P 3306 -ua -ppwd -e "select * from test.t"
+------+
| a |
+------+
| 2 |
+------+
mysql -h 127.0.0.1 -P 3306 -u root -e "set @@global.read_only=1"
mysql -h 127.0.0.1 -P 3306 -ua -ppwd -e "select * from test.t"
ERROR 1290 (HY000) at line 1: The MySQL server is running with the --read-only option so it cannot execute this statement
@raghavendra-prabhu
here is the test case
1. start a single node cluster
bin/mysqld_safe --defaults- file=/DATA/ mysql/my. cnf --wsrep_ cluster_ address= gcomm:/ / &
2. create a normal user with permission to select on a table
mysql -h 127.0.0.1 -P 3306 -u root test -e"
drop table if exists t;
create table t (a int) engine=innodb;
insert into t values (2);
grant select on test.t to 'a'@'%' identified by 'pwd';
"
3. select statement will be blocked if read_only was set
mysql -h 127.0.0.1 -P 3306 -u root -e "set @@global. read_only= 0"
mysql -h 127.0.0.1 -P 3306 -ua -ppwd -e "select * from test.t"
+------+
| a |
+------+
| 2 |
+------+
mysql -h 127.0.0.1 -P 3306 -u root -e "set @@global. read_only= 1"
mysql -h 127.0.0.1 -P 3306 -ua -ppwd -e "select * from test.t"
ERROR 1290 (HY000) at line 1: The MySQL server is running with the --read-only option so it cannot execute this statement