Categories
Database

How to Fix PostgreSQL Connection to Server Failed?

Home » Database » How to Fix PostgreSQL Connection to Server Failed?

Background

Firstly, here is the error message displayed when attempting to log in to PostgreSQL:

psql: could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
psql: could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?

The reason for this error is simple: you are not actually connected to the server—psql (PostgreSQL) is not running. Here are the steps to start it:

How to Fix PostgreSQL Connection to Server Failed?

Environment:

Windows 10

PostgreSQL 10

Steps to fix the connection issue:

1. Search for Control Panel in the bottom-left corner of your computer.

2. In the top-right corner of the Control Panel, search for Administrative Tools.

3. Open Administrative Tools and find Services, then double-click to open it.

4. In the Services window, find the service provided by PostgreSQL 10 and start it.

5. Finally, test to see if it has started.

That’s it! This resolves the issue of PostgreSQL unexpectedly stopping. Simply restart the service, and it should be working again.

By Jaxon Tisdale

I am Jaxon Tisdale. I will share you with my experience in Network, AWS, and databases.

Leave a Reply

Your email address will not be published. Required fields are marked *