“psql: could not connect to server: Connection refused” Error when connecting to remote database
open file named postgresql.conf add this line to that file then open file named pg_hba.conf and add this line to that file It allows access to all databases for all users with an encrypted password restart your server