I have a python script to add data to a postgres database. During testing, I had created a database in the localsystem and it worked perfectly. Now I have the database running in linode. I am not sure how to connect to the database from the localsytem. I have the database details stored in a python file as follows
DATABASE = 'my_database'HOST = <IP_ADDRESS> # the ip_address of the linode instancePORT = '5432'USER = 'database_user'PASSWORD = 'database_password'I use the above code in access the database. in case of the database running in the localhost, the host was equal to HOST = 'localhost'.
When I run the python script from the localsystem to connect to the database this is the message I get
psycopg2.OperationalError: connection to server at "<IP_ADDESS>", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections?I am not sure how to connect to the database running in linode.