Link to home
Start Free TrialLog in
Avatar of dannydudek
dannydudek

asked on

How to make MySQL Slave "read-only"?

Hi All,

I have setup master-slave MySQL replication, which works great, however I would like to make sure, that slave database cannot be modified. Is there any way i could make it "read-only"?

I was thinking about changing users permission on the slave, however that could cause break in replication (the entire server is replicated).

Avatar of Adrian Pop
Adrian Pop
Flag of Sweden image

Avatar of dannydudek
dannydudek

ASKER

I actually read that, but this way the replication stops, and is read  only not only to users, but also to master.


Ok, let me undestand what you want here. Let's see if I understand correctly:
1. Master - Slave replication
2. Master push all the queries to Salve
3. You want to block the update/delete/insert/create to the Slave

But then this is not replication anymore!
If the Master gets an insert then it pushes that to the Slave and
the slave rejects it. Then the databases are not the same anymore.
The replica contains less data.

Or you want  to just block update/delete??!
But then again your replica is not the same as the one you have on master!!
So which one is it?

Cheers,
za-k/

I want slave to be up to date with master, but i want to make sure that users cannot modifiy anything on the slave.
ASKER CERTIFIED SOLUTION
Avatar of Adrian Pop
Adrian Pop
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Isn't http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_read_only what you're looking for?

If so, place "read_only" on a line (by itself) under [mysqld] on your slave's my.cnf