When I originally set up my master-to-master replication, I used:
binlog-ignore-db=mysql
and have been syncing the user accounts and grants manually. This is simply how it was done in the how-to I was using at the time. But is there any reason why I shouldn't remove this line and allow the mysql
database itself to replicate as well?
If so: Before I make the change, besides making sure that all the grants are the same on both (or better stated, that the entire mysql database is identical), is there anything else I should double-check or be aware of?
It is entirely possible to give yourself mysql permissions without knowing SQL GRANT commands.
Example : Here is to create your own user with full privileges using SQL GRANT from anywhere called superdba with a password of ClarkKent:
Here is how you can do this without the GRANT command:
First of all, here is mysql.user for MySQL 5.1.51
Just execute these SQL commands:
That INSERT is a legal SQL statement that can land in a binary log. Do you want someone to run this and have a visible password travel along the network? to sit in a binary log on the master? to sit in a relay log on the slave?
Having this directive
prevents giving away mysql permissions using such SQL. However, GRANTs cannot be stopped this way. Therefore, make sure you perform grants like this:
to prevents the GRANTs from traversing from master to slave.
I've had no problems with replicating the mysql database, but then again, my infrastructure lends to an additional level of security with firewalls and proxy appliances where it's impossible for anyone other than the infrastructure folks to even connect on any of the ports MySQL uses. It does add an extra level of convenience knowing that you only have to grant permissions once and have it replicated. When it boils down to it, as long as you have properly set the host as to not expose it to anyone other than the intended (e.g. you, the slave, etc...), you should be fine.
If you're overly concerned with man in the middle interceptions, there's always the option of sending replication across over SSL.