Sample Header Ad - 728x90

How to lock all tables except some specific table?

0 votes
1 answer
162 views
I am trying to set a stage server which replicate some tables like articles, user etc from master. If I start the slave server as read_only I am not able to my stage site up because there are some tables like cache or session which needs to be rewritten. So I am trying to use replicate_do_table and then locking those tables manually using below snippets and let other tables like cache and session rewritable. In short I want read_only lock for all the tables in a database excluding some specific tables to read-write access. I found below snippet on mysql website. But how can I select only specific tables without writing all the table names manually inside LOCK TABLES LOCK TABLES tbl_name [[AS] alias] lock_type [, tbl_name [[AS] alias] lock_type] ... lock_type: { READ [LOCAL] | [LOW_PRIORITY] WRITE } Note: I am using innodb storage engine and mariadb 10.3
Asked by SkyRar (125 rep)
Jan 4, 2019, 04:58 AM
Last activity: Jul 12, 2025, 09:00 PM