linux - 我无法连接到我的 postgresql 数据库
问题描述
我在 wsl 上使用 ubuntu 20.04 并安装了 postgres true the normal sudo apt-get install
。我知道有相关的问题,但没有解决我的问题。
每当我运行 psql 时,它都会返回此错误
psql: error: 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"?
我试图重新启动/启动 psql 服务器,但随后发生此错误
$ sudo service postgresql start
* Starting PostgreSQL 13 database server * Error: /usr/lib/postgresql/13/bin/pg_ctl /usr/lib/postgresql/13/bin/pg_ctl start -D /var/lib/postgresql/13/main -l /var/log/postgresql/postgresql-13-main.log -s -o -c config_file="/etc/postgresql/13/main/postgresql.conf" exited with status 1:
2021-06-15 22:40:51.285 CEST [74] LOG: starting PostgreSQL 13.3 (Ubuntu 13.3-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit
2021-06-15 22:40:51.297 CEST [74] LOG: could not bind IPv4 address "127.0.0.1": Permission denied
2021-06-15 22:40:51.297 CEST [74] HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2021-06-15 22:40:51.297 CEST [74] WARNING: could not create listen socket for "localhost"
2021-06-15 22:40:51.297 CEST [74] FATAL: could not create any TCP/IP sockets
2021-06-15 22:40:51.304 CEST [74] LOG: database system is shut down
pg_ctl: could not start server
Examine the log output.
解决方案
推荐阅读
- python - Python 如何管理相对路径
- c++ - 在 C++ 中反转字符串(使用递归)
- python - SQLite3 中简单选择查询(使用索引)的性能问题
- scala - 根据值组合两个数据集
- react-native - Android:尝试使用 fetch 上传图像时网络请求失败
- vue.js - 将自定义指令添加到 vuejs 渲染函数中的插槽
- javascript - 如何隐藏已注销用户的内容?
- android - 如何在谷歌地图片段android工作室中导入KML多边形文件
- angular - App module.ts Angular文件中这三行的含义是什么
- c++ - 在 Qt 5.3 版中将 QString 转换为 QChar