如何解决PostgreSQL无法连接
我正在尝试为项目首次使用PostgreSQL。我正在将Microsoft Visual Studio与Ubuntu终端一起使用。目前,我已经在互联网上搜索了7个小时以上,而且我绝对无法弄清楚如何使该服务器运行。似乎拒绝了带有“权限被拒绝”错误的连接。在这一点上,我已经尝试了该站点以及其他十二个站点的许多不同建议。我很茫然。
config_file="/etc/postgresql/12/main/postgresql.conf" exited with status 1:
2020-08-23 00:41:40.319 EDT [6708] LOG: starting PostgreSQL 12.2 (Ubuntu 12.2-4) on x86_64-pc-linux-gnu,compiled by gcc (Ubuntu 9.3.0-8ubuntu1) 9.3.0,64-bit
2020-08-23 00:41:40.322 EDT [6708] LOG: could not bind IPv4 address "127.0.0.1": Permission denied
2020-08-23 00:41:40.322 EDT [6708] HINT: Is another postmaster already running on port 5432? If not,wait a few seconds and retry.
2020-08-23 00:41:40.322 EDT [6708] WARNING: could not create listen socket for "localhost"
2020-08-23 00:41:40.322 EDT [6708] FATAL: could not create any TCP/IP sockets
2020-08-23 00:41:40.323 EDT [6708] LOG: database system is shut down
pg_ctl: could not start server
I also get this error when trying to access my server through rails:
psql: error: could not connect to server: 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"?
解决方法
可能是因为“ SELinux”。确保它处于“宽松”模式。
setenforce 0
# getenforce
Permissive
有关配置的更多信息:https://www.thegeekdiary.com/how-to-disable-or-set-selinux-to-permissive-mode/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。