有createuser&dropuser命令:
createuser - define a new PostgreSQL user account
dropuser - remove a PostgreSQL user account
Run Code Online (Sandbox Code Playgroud)
有没有相应的方法来列出用户帐户?
这两个命令不需要用户调用psql或了解使用它的细节。
简单的问题,但没有找到有关此的资源。有没有什么办法可以只安装PostgreSQL客户端,基于终端的客户端,在psqlCentOS7系统上,而不安装完整的PostgreSQL服务器?存储库上没有专用的postgresql-client或postgresql94-client类似的东西。
遵循UNIXMEN 的所有说明,安装postgresql-9.4在CentOS 6.4. 一切顺利,启动服务并可以访问pgsql屏幕。但是当我尝试配置时phpPgAdmin,我找不到文件
说明说,postgresql主目录将位于/etc/../,有些人说它将位于/var/lib/. 目录在哪里创建(在 CentOS 中)?
centos, redhat(RHEL7) & ubuntu 的安装目录路径不同吗?
更新:
我为 *postgresql.conf** 和 *hba.conf** 运行了一个快速定位命令,我发现示例文件为postgresql.conf.sample和pg_hba.conf.sample(在/usr/pgsql-9.4/share/)
我正在将 postgresql 安装到第二台服务器上
以前我安装了 postgresql,然后使用了提供的脚本
./contrib/start-scripts/linux
Run Code Online (Sandbox Code Playgroud)
放入正确的目录
# cp ./contrib/start-scripts/linux /etc/rc.d/init.d/postgresql92
# chmod 755 /etc/rc.d/init.d/postgresql92
Run Code Online (Sandbox Code Playgroud)
然后我可以按预期执行
# service postgresql92 start
Run Code Online (Sandbox Code Playgroud)
然而,新机器使用的是 Systemd,看起来有一种完全不同的方法来做到这一点
我不想破解并破坏某些东西,所以我想知道是否有人可以指出我如何实现相同结果的正确方向
我有一个 postgres 9.1 服务器在 Ubuntu 12.04 云服务器上的默认端口 5432 上运行。
我想打开端口,这样我就可以进行远程查询——但是我必须在 IP 表上打开端口,这需要我指定一个协议。这个文档没有提到 TCP/UDP 等。
我应该在 IP 表中允许什么协议?
我已经通过 pacman 安装了 postgresql。现在我正在尝试运行它:
$ sudo systemctl start postgresql
Job for postgresql.service failed because the control process exited with error code.
See "systemctl status postgresql.service" and "journalctl -xe" for details.
Run Code Online (Sandbox Code Playgroud)
进而:
$ sudo systemctl status postgresql
? postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2016-07-10 15:30:47 UTC; 17s ago
Process: 19468 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=1/FAILURE)
Jul 10 15:30:47 my_comp systemd[1]: Starting PostgreSQL database server...
Jul 10 15:30:47 my_comp systemd[1]: …Run Code Online (Sandbox Code Playgroud) 在我的 Debian Wheezy系统中,我注意到 postgres 用户“postgres”,即“PostgreSQL 管理员”,/bin/bash用作 shell。但是,我无法弄清楚为什么需要这样做。将此更改为/bin/false仍然允许我使用命令psql.
那么,为什么系统用户postgres需要一个 shell,它必须是专门的/bin/bash吗?
我开始使用 postgres docker 容器
sudo docker run --name some-postgres -d postgres
然后尝试使用连接到它
sudo docker run -it --rm --link some-postgres:postgres postgres psql -h postgres
这给出了错误 psql: FATAL: role "root" does not exist
这些命令与docker hub 页面上列出的命令完全相同仅以 root 身份运行,不以-e POSTGRES_PASSWORD=mysecretpassword
我在这里做错了吗?什么可能导致这种情况?
实际上,我安装了 PostgreSQL 9.4(带有 postGIS 扩展),安装后一切正常。
正如许多人所说,我已经设置了 /data 文件夹,检查了配置文件等等。在其他项目上工作所以我有一段时间没有在 psql 上工作但是当安装完成后,它曾经正常工作,我做了一个测试数据库,初始化了 postgres 用户等。
现在,我尝试启动 psql(使用“默认”postgres 用户)但无法连接!启动/停止/重启服务不会改变任何东西...
“psql”命令的结果(使用 postgres 用户):
psql: could not connect to server: No such file or directory
Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)
当我检查服务状态时,我得到这个:
postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled)
Active: active (exited) since tue 2016-05-24 09:24:13 CEST; 3s ago
Process: 5658 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 5658 (code=exited, status=0/SUCCESS)
Run Code Online (Sandbox Code Playgroud)
使用命令启动/停止/重新启动服务
sudo service postgresql start (or restart or stop) …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 CentOS-8 中安装 postgresql-12 我根据postgresql.org网站 添加了 postgresql 存储库https://www.postgresql.org/download/linux/redhat/
dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Run Code Online (Sandbox Code Playgroud)
所以现在我添加了存储库
[root@centos8cmd ~]# dnf repolist
Last metadata expiration check: 0:08:03 ago on Tue 08 Oct 2019 03:29:54 AM GMT.
repo id repo name status
AppStream CentOS-8 - AppStream 4,928
BaseOS CentOS-8 - Base 2,713
*epel Extra Packages for Enterprise Linux 8 - x86_64 1,816
extras CentOS-8 - Extras 3
pgdg10 PostgreSQL 10 for RHEL/CentOS 8 - x86_64 509
pgdg11 PostgreSQL 11 for RHEL/CentOS 8 - x86_64 …Run Code Online (Sandbox Code Playgroud)