Forums

psql: could not connect to server: Connection refused

Hello,

I'm having a hard time trying to put my web app online. I just bought a hacker account with a postgresql server but I can't connect to it, even from the bash. When I'm using the command psql -h jumertz-30.postgres.eu.pythonanywhere-services.com -d site_web -U jumertz --port=10667, I get the following error : psql: could not connect to server: Connection refused Is the server running on host "jumertz-30.postgres.eu.pythonanywhere-services.com" (10.0.0.113) and accepting TCP/IP connections on port 10667? It looks like the server is not active but I don't understand how I can activate it.

Thank you in advance for your help !

It looks like you're not using the correct port number. It is shown on your Databases tab.

You are right, I don't know why I was using 10667. Thanks for the help and sorry for the inconvenience.

Hello, I downloaded the postgres file via pg_dump from my computer. Then I added it to my files on the site. But i don't know how to activate it so that works at the server. I mean how to connect database postgres via the console along the path: home/Databases/Postgres. Please, help

You'll need to use the pg_restore command to load the data from the files that pg_dump produced into your Postgres database. I would recommend using the --create command-line option, so that it creates the databases for you.