Skip to Content
Menu
This question has been flagged
4 Replies
39538 Views

I got issue in my odoo 13 conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

How can i solve this problem.Yesterday was everything working fine.

Avatar
Discard
Best Answer

Goto Postgres Conf file pg_hba.conf and add your Postgres user in the format of

host    <user name>   <ip/network>   md5

For Example, create a new Postgres user odoo and add it section after Linux/UNIX domain.

Follow these steps:

  • Make a backup copy of the pg_hba.conf file before you alters it.
  • If the PostgreSQL postmaster is already running, stop it using the pg_ctl stop command or windows defined way.  
  • Open the pg_hba.conf file in a text editor. 
  • Here my IP is a default and not configured any extra. So using localhost/127.0.0.1 and update

  • # "local" is for Unix domain socket connections only, Here accepts all users and ips with peer auth
    local all all peer
    # Windows with new User odoo, all ips, with auth trust
    host all             odoo trust
    # IPv4 local connections:
    host all all 127.0.0.1/32 md5
  • you can change the auth method as md5/trust with a new user. The authentication method varies according to your needs. I can share with you the basic PSQL Windows deployment DOC.

    WIndows Postgres Deployment

    TO know more about the Postgres configuration file, please refer here

    https://www.postgresql.org/docs/9.3/auth-pg-hba-conf.html

    https://desktop.arcgis.com/en/arcmap/10.3/manage-data/gdbs-in-postgresql/configure-postgresql-accept-connections.htm


    Avatar
    Discard
    Best Answer

    Hi,

    Please check the answer given by Ermin here in this question and update the pg_hba.conf file accordingly: Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?

    Thanks

    Avatar
    Discard
    Author

    not working for me

    Best Answer

    i have the same issue at linux environment i edited the pg_hpa.conf and it didn't work could anyone tell me the correct way to edit it (the line i should add and where should i add it exactly ) because I'm new to programming

        conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
    psycopg2.OperationalError: could not connect to server: Connection refused
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432? - - -



    Avatar
    Discard
    Related Posts Replies Views Activity
    0
    Aug 22
    675
    0
    Aug 23
    844
    3
    May 24
    6580
    1
    Mar 15
    4720
    0
    Feb 22
    5315