By default PostgreSQL is configured to be bound to localhost only, and any attempt to connect to the PostgreSQL server from outside will be refused. To make the connection possible from outside, you will need to make few changes in PostgreSQL configuration file.
Configure PostgreSQL
First you will need to locate postgresql.conf file using the following command:
This will return you the absolute path of the file, edit postgresql.conf file with any of your favorite text editor: Uncomment the following lines, and replace localhost like below:
Save and close the file when you are finished.
Next, locate pg_hba.conf file using the following command:
This will return you absolute path of the file, edit pg_hba.conf file with any of your favorite text editor: Add the following line at the end of the file:
Save and close the file when you are finished.
Restart PostgreSQL to take changes into effect:
Now go to the pgAdmin and access your PostgreSQL database:
Enter your database server name in the Name box, then click Connection tab.
This will establish a connection to your PostgreSQL server, and show you all the information of your databases as shown in below screenshot:
No comments: