在Ubuntu中安装postgresql时遇到的问题

问题描述 投票:0回答:1

我想在ubuntu中安装postgresql,但是面临很多问题,搜索了很多但仍然没有成功,所以当我尝试安装时,我使用了以下命令:

sudo su -
apt-get install postgresql-9.5
update-rc.d postgresql enable

安装完成后,出现错误

9.5 main    5432 down   postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log

以及当我给出以下命令后

sudo -i -u postgres
psql

它给了我

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"?

我该如何解决?

linux postgresql ubuntu-18.04 postgresql-9.5
1个回答
0
投票

在Postgres中,您需要以名为postgres的特定用户身份进行连接。

尝试执行此操作:sudo -i -u postgres,然后使用psql

© www.soinside.com 2019 - 2024. All rights reserved.