pgsql 9.4修改数据库只读
2024-10-15 12:39:20
先进入psql
切换到目标数据库
\c mydb
对于老表
grant usage on schema public to $read_only_user;
grant select on all tables in schema public to $read_only_user;
设置默认,对于未创建的表直接默认赋予只读权限
alter default privileges for user $db_owner in schema public grant select on tables to $read_only_user;
pubic这个schema是默认的schema
阿里云得创建superuser,然后赋予default_transaction_read_only属性,不然貌似不行
select usename,useconfig from pg_user where usename='xxx';
alter role xxx set default_transaction_read_only=true;
select usename,useconfig from pg_user where usename='xxx';
推荐用这个,简单方便
测试建表语句
create table t2 ( id serial, name varchar() );
最新文章
- AngularJS SPA Template For Visual Studio
- PHP character garbled
- Ajax学习笔记1之第一个Ajax应用程序
- 对URL编码
- C#窗体 自定义控件
- input 标签实现带提示文字的输入框
- Unity3D脚本语言UnityScript初探
- gym101090 I Painting the natural numbers
- 【转】c语言入门教程 / c语言入门经典书籍
- 生产项目加入到SVN版本控制
- strlen与sizeof有什么区别?
- Charts 常见使用类型实例
- HBase写数据
- 第22章 使用外部身份提供商登录 - Identity Server 4 中文文档(v1.0.0)
- 小tips:JS中typeof与instanceof用法
- 老男孩python学习自修【第二天】字符串用法
- http转发
- checkbox简单例子
- 02 http,servlet,servletconfig,HttpServletRequest ,HttpServletResponse
- this与$scope