Mysql – Why does MySQL Galera not replicate the user table

galeraMySQLreplication

I am running a 3 node MySQL 5.6 Galera Cluster. Everything is in sync and looks fine, but as I just found out the user table was not in sync.

One particular user was not present on the other nodes where I thought it might replicate it after issuing:

mysql -u root -p -e "INSERT INTO mysql.user (Host,User) values ('10.0.0.10','haproxy_check'); FLUSH PRIVILEGES;"

I double checked wsrep status and user tables on all nodes. After issuing the command on the other 2 nodes it is available and galera seems to be still in sync.

Am I missing something here? Why is galera not replicating the user table?

Best Answer

It is in the known limitations:

Currently replication works only with the InnoDB storage engine. Any writes to tables of other types, including system (mysql.*) tables are not replicated (this limitation excludes DDL statements such as CREATE USER, which implicitly modify the mysql.* tables — those are replicated). There is however experimental support for MyISAM - see the wsrep_replicate_myisam system variable)

So using proper CREATE USER statement will replicate, your INSERT INTO mysql.user statement will not.

I can't quite find a suitable reference if GRANT statements are considered DDL statements and will replicate or not.