check_latest_version && sudo apt update && sudo apt upgrade -y
Verify service status:
sudo systemctl status postgresql
sudo -u postgres psql -c "SELECT version();"
ps aux | grep postgres
Try different auth methods:
sudo -u postgres psql
psql -U username -d database -h localhost
psql -l
Verify PostgreSQL config:
sudo cat /etc/postgresql/*/main/pg_hba.conf
sudo cat /etc/postgresql/*/main/postgresql.conf
PostgreSQL server unreachable, authentication failed, or database does not exist.
tail -f /var/log/postgresql/postgresql-*.log
netstat -tlnp | grep 5432
sudo -u postgres psql -c "SELECT * FROM pg_stat_activity;"