简体   繁体   中英

Postgresql: Connection refused Is the server running on host “127.0.01” (127.0.0.1) and accepting TCP/IP connections on port 5432?

连接错误

I am a student learning Postgresql and I am having a consistent newbie error / mistake.

After a fresh install of postgres, am a able to make a new database, create tables, etc on a db on 127.0.0.1. Everything works fine until I restart my machine and try to relogin into my database. I get the error above in the picture.

I installed with the following commands:

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';

What else did I need to configure? Why do I get locked out after a restart? Any ideas? I am totally stuck...

Probably postgres service is stopped. You can check

sudo systemctl status postgresql

If it's off you can start it

sudo systemctl start postgresql

To make it permanent you can set it to auto start

sudo systemctl enable postgresql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM