Description:
I created a mysql master and slave instance.I create a table with a special column that named '111' on master. It is ok for master and slave. But when I grant the privilege of select on the column named '111' , I get an error on slave. the error code is 1064 and slave_sql_running status is no,it is ok on master.
How to repeat:
step 1: create a mysql master and slave without any special configuration in my.cnf
step 2: on master:
CREATE USER 'replication'@'192.168.1.149' IDENTIFIED BY 'replication';
GRANT REPLICATION SLAVE ON *.* TO 'replication'@'192.168.1.149';
CREATE USER 'test'@'192.168.1.149' IDENTIFIED BY 'test';
step 3: on slave:
CHANGE MASTER TO MASTER_HOST='192.168.1.149',MASTER_PORT=33061,MASTER_USER='replication',MASTER_PASSWORD='replication', MASTER_AUTO_POSITION = 1;
start slave;
step 4: on master:
create database test;
use test;
create table `111` (`222` int);
grant select(`222`) on `test`.`111` to test@'%' identified by 'test';
it is ok on master.
step 5: on slave:
show slave status\G;
you will get an error code 1064,slave_sql_running is no and error message is
"Error 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '222)......"
Suggested fix:
Add the code "cols.append(STRING_WITH_LEN("`"));" before and after the line 236 in sql_rewrite.cc