#opening postgresql config file to enabling from local to everyone
#firt open this file on machine to make changes
sudo vi /etc/postgresql/12/main/postgresql.conf
#to quickly search on editor easily type as '/' & the type word to search 'listen_address'
#by default listen_addresses = 'localhost'
#so we are changing 'localhost' to '*' it means by placing the '*' any one can access.
listen_addresses = '*'
#now change one more config file called 'pg_hba.config' to give access, so open the file as below
sudo vi /etc/postgresql/12/main/pg_hba.conf

# add the line end of the file 
host    all             all                  md5

#for above mentioned line reference in  detailed

# now restart the postgres so it will restart the service and apply the changes internally
# first check the status 
 sudo service postgresql status
# now restart the postgresql service
 sudo service postgresql status

downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter