postgresql - pg_dump 和超级用户
问题描述
如果我是系统用户 postgres,PostgreSQL 允许我以超级用户身份连接:
[T] jeff@nantes-5p:~ $ sudo -u postgres psql
psql (10.15 (Ubuntu 10.15-0ubuntu0.18.04.1))
Type "help" for help.
postgres=#
结果,我巧妙地没有创建超级用户。但似乎 pg_dump 不提供此快捷方式:
130,[T] jeff@nantes-5p:~ $ sudo -u postgres pg_dump -h localhost -p 5432 -U postgres -w
pg_dump: [archiver (db)] connection to database "postgres" failed: fe_sendauth: no password supplied
1,[T] jeff@nantes-5p:~ $ sudo -u postgres pg_dump -h localhost -p 5432 -w
pg_dump: [archiver (db)] connection to database "postgres" failed: fe_sendauth: no password supplied
1,[T] jeff@nantes-5p:~ $ sudo -u postgres pg_dump -h localhost -w
pg_dump: [archiver (db)] connection to database "postgres" failed: fe_sendauth: no password supplied
1,[T] jeff@nantes-5p:~ $
我错过了什么?创建超级用户只需要 root 但转储表需要 root 可以做的事情,这似乎不一致,而且有点愚蠢。
解决方案
推荐阅读
- javascript - 尝试将 HTML 文件转换为包含套接字 io 的 JavaScript 时出现语法错误,SyntaxError: Unexpected token <
- if-statement - 使用 if-then-else 打印文件和目录并说明它是文件还是目录
- c++ - 如何将 `void *` 类型更改为 `string` 类型
- python - Flask 虚拟环境和环境变量
- json - 如何在akka-Http中返回JSON而不是Case Class
- batch-file - 如何使用批处理将日期和时间写入同一行的日志文件
- android - 将联系人图像添加到 MessagingStyle 通知“人员”
- css - 从 JSON 中提取的图像未显示在网格中
- java - 在 Java 中增加数组大小的同时向数组添加值
- jquery - 如何使用 jquery 在 ckeditor 中显示 JSON 响应值?