Because PostgreSQL does not correctly set the allowed IP address, we often cannot connect to a database server remotely.
Machine A installs PostgreSQL. The default port is 5432.
To remotely connect machine B to the postgresql service of machine.
1. If host a starts Windows Firewall, add Port 5432 to "add Port" in "exception.
2. Modify in PostgreSQL. conf
Listen_addresses = '*'
Port = 5432
3. Add
Host All all 192.168.1.2/32 Trust
Try to connect to machine a 192.168.1.1 with phpPgAdmin on machine B.
Const char * conninfo = "host = * dbname = s user = s Password = root Port = 5432 connect_timeout = 5"; pgconn * conn = pqconnectstart (conninfo ); // pgui_exec (); connstatustype connstatus = pqstatus (conn); If (connstatus! = Connection_ OK) {fprintf (stderr, "connection to database failed: % s", pqerrormessage (conn); // exit_nicely (conn );}