![](/img/trans.png)
[英]Rails in linux. Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432?
[英]Postgresql: Connection refused Is the server running on host “127.0.01” (127.0.0.1) and accepting TCP/IP connections on port 5432?
我是一名学习 Postgresql 的学生,我遇到了一致的新手错误/错误。
全新安装 postgres 后,我能够在 127.0.0.1 上的数据库上创建新数据库、创建表等。 一切正常,直到我重新启动机器并尝试重新登录到我的数据库。 我在图片中得到了上面的错误。
我使用以下命令安装:
echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" | sudo tee -a /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt-get update
apt-get install postgresql-12
apt-get install pgadmin4
chmod -R a+wrx /var/lib/postgresql
sudo -u postgres psql
ALTER USER postgres PASSWORD 'setnewPassword';
我还需要配置什么? 为什么我重启后会被锁定? 有任何想法吗? 我完全被困住了......
可能 postgres 服务已停止。 你可以检查
sudo systemctl status postgresql
如果它关闭,你可以启动它
sudo systemctl start postgresql
要使其永久化,您可以将其设置为自动启动
sudo systemctl enable postgresql
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.