Mysql – Should I exclude thesql database from multi master replication

MySQLreplication

Running mysql in a two master replication setup. There are many databases and they are all replicating correctly including the mysql database itself.

Is it safe to replicate mysql or should I exclude it via the my.cnf ?

Best Answer

Since the mysql schema is usually manipulated with GRANT and REVOKE commands, there is no need to let the mysql schema replicate. Why ?

Someone could hack privileges in by means of INSERT commands into mysql.user.

Such hacks are possible because I wrote about it before

If these hacks were done on a Master, a Slave might intercept them. The new grants on the Slave would not be active until someone restarted mysqld on the Slave or ran FLUSH PRIVILEGES; on the Slave.

So, to answer your question: exclude it via the my.cnf