Did you mean to connect to: postgresql://localhost:5432?
Port 5432 is for PostgreSQL database connections. Use psql or your database client to connect.
sudo systemctl status postgresql
(Linux)brew services list | grep postgresql
(Mac)pg_ctl status
(Windows)
psql -U postgres
psql -h localhost -p 5432 -U username -d database
lsof -i :5432
(Mac/Linux)netstat -ano | findstr :5432
(Windows)
sudo systemctl start postgresql
(Linux)brew services start postgresql
(Mac)pg_ctl start
(Windows)
Port 5432 is the default port for:
PostgreSQL server is not running or not accepting connections:
sudo systemctl start postgresql
psql --version
sudo netstat -tlnp | grep 5432
sudo tail -f /var/log/postgresql/postgresql-*.log
Authentication error when connecting to PostgreSQL:
sudo -u postgres psql ALTER USER postgres PASSWORD 'newpassword';
sudo -u postgres psql
CREATE USER username WITH PASSWORD 'password'; GRANT ALL PRIVILEGES ON DATABASE dbname TO username;
Trying to connect to a non-existent database:
\l
in psqlpsql -U postgres
CREATE DATABASE dbname;
Another process is using PostgreSQL's port:
lsof -i :5432
sudo systemctl stop postgresql
port = 5433
sudo systemctl restart postgresql
PostgreSQL user/role doesn't exist:
sudo -u postgres createuser --interactive
CREATE ROLE username LOGIN PASSWORD 'password';
\du
in psqlpsql -U postgres