set global read_only = 1;
是把实例下所有的库都给锁了lock table T1 read;
lock table T2 read;
lock table T3 read;
..............
1
GTim 2023-03-01 10:30:16 +08:00
要 global
|
2
wps353 2023-03-01 10:42:50 +08:00
MySQL 8.0.22 以上的版本可以设置库级别的 read only.
"The READ ONLY option, introduced in MySQL 8.0.22, controls whether to permit modification of the database and objects within it. The permitted values are DEFAULT or 0 (not read only) and 1 (read only). This option is useful for database migration because a database for which READ ONLY is enabled can be migrated to another MySQL instance without concern that the database might be changed during the operation." |