开发者

MySQL: How to turn one database to read-only?

I need to turn one database into read-only, so I can clone the database and make schema modifications on the clone before we switch the application to the new database. I know the way to turn the MySQL database server into read-only, but that will make it impossible to do the schema change on the new cloned database.

I searched and didn't find any answer. I suspect there is no such feature. In that case, what would you recommend for upgrading a live database without p开发者_高级运维ausing the service?


You could revoke write access for specific users during this period.


You could revoke update/insert/delete privilege on the account that is using that database. If the application is logged in as root then you have bigger problems on your hands.


Put read_only=1 in my.cnf and restart the MySQL server. You will still be able to modify the schema as the superuser.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜