xiaoyusilen
xiaoyusilen

Reputation: 201

How to connect my local postgresql with my local ip address

My question is, I install the postgresql in my Mac, then I want to connect my postgresql with my local IP address.

For example, my local IP address is: 10.xxx.xxx.xxx, I want to command aspsql -U username -d dbname -h 10.xxx.xxx.xxx to instand of command psql -U username -d dbname -h 127.0.0.1.

I has added my IP address to pg_hba.conf, and changed listen_address in postgresql.conf to listen_address = '*', but not worked.

Thanks for answer.

Upvotes: 1

Views: 12290

Answers (2)

Konstantin
Konstantin

Reputation: 41

if you run both and postgres and grafan from containers you have to check

$docker network inspect bridge

In my case there should be ip:172.17.0.4 and port: 16 instead of lochalhost and 5432. Those ip and port docker assigns automatically while makes the bridge between containers I guess.

Upvotes: 0

Lohit Gupta
Lohit Gupta

Reputation: 1081

Add your local IP in /etc/hosts file and then try again. Like below:

127.0.0.1   localhost
10.xxx.xxx.xxx  localhost

Upvotes: 2

Related Questions