分类 database 中的文章

Pgsql Create Readonly Account

Pgsql Create Readonly Account 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2023/10/25/pgsql-create-readonly-account/ 授权 schema 只读权限 登陆到数据库 1 $ psql -u root -d dbname ; 切换到对应数据库 1 sql> \c dbname; 创建用户并授权 1 2 3 4 5 6 7 8 9 10 11 12 -- 创建用户 CREATE USER <USER_RO> WITH PASSWORD '<PASS_FOR_USER_RO>'; -- 授权 public schema 可以不用。 -- 授权非 public schema 需要保留。 GRANT USAGE ON SCHEMA <SCHEMA_NAME> TO <USER_RO>; -- 授权制度权限 GRANT SELECT ON ALL TABLES IN SCHEMA <SCHEMA_NAME> TO <USER_RO>; --授予将来新……

阅读全文

Aliyun RDS PostgreSQL权限管理最佳实践

Aliyun Rds Pgsql Permission Best Practise 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2023/07/14/aliyun-rds-pgsql-permission-best-practise/ 注意: 在 PgSQL 中, 用户是基于 实例 的, 权限是基于 数据表/数据库 的。 换句话说, 创建的用户是可以看见所有数据库和数据表的, 但是看不到其具体内容。 创建只读用户 0. 登陆/切换 目标数据库 直接登陆目标数据库 1 2 ## login psql -u root -d dbname ; 或者登陆后切换到目标……

阅读全文

Pgsql Stop Spliting Values in Mulitple Lines

Pgsql Stop Spliting Values in Mulitple Lines 建议点击 查看原文 查看最新内容。 原文链接: https://typonotes.com/posts/2023/07/13/pgsql-stop-spliting-values-in-mulitple-lines/ psql doesn’t split your string in multiple lines. It’s the string that contains new-line characters (ASCII 10), and psql displays them accurately. The + at the end of every line is psql’s way of telling you that the value is continued in the next line. You can use the unaligned mode (psql option -A) to get rid of the +, but the output format is less attractive then. You can get rid of the newlines in a string with 1 2 3 4 5 SELECT translate(..., E'\n', ''); # or SELECT REPLACE(..., E'\n', ''); decode will be able to handle such a string.……

阅读全文

Pgsql数据库: psql 命令非交互式备份与恢复

Pgsql数据库: psql 命令非交互式备份与恢复 通常, 我们在使用 psql 命令的时候, 使用交互式命令, 输入密码, 保证安全。 1 2 3 4 5 # 备份 pg_dump -U root -h 172.17.101.250 -W -d intelliep_event > demo.sql # 登录 psql -U root -h 172.17.101.250 -W -d intelliep_event < demo.sql 非交互式操作 但是在 脚本 中执行备份和恢复的时候, 交互式的输入密码就非常不方便了。 要实现非交互式, 非常简单。 只需要……

阅读全文

福利派送

  • 又拍云免费 CDN

最近文章

分类

标签

其它