Mysql – How to set mariadb read_write for some specific tables while starting as read_only=1

innodbmariadbMySQLread-only-database

I am trying to set a mariadb slave which is exact replica of master db. As per the suggestion I start my slave with command --relay-log=mysql-relay-bin" "--log-slave-updates=1" "--read-only=1" . But as I use my slave db as a stage server of my website, I need some tables like cache_* writable to make my stage server work perfectly.

Can you please help me if it is possible or not ? If not then is there any workaround for it ?

Best Answer

Plan A: Turn off read_only and hope that no one abuses it (accidentally or deliberately).

Plan B: Run the 'cache' stuff as some user with SUPER so that it can bypass read_only. This seems more secure than Plan A, but opens up other risks.