Mac installs PostgreSQL by default, so that PostgreSQL can be accessed remotely
Source: Internet
Author: User
Mac installs postgresql by default, how to make postgresql remotely accessible
The default storage path of the mac postgresql directory is / usr / local / var / postgres /. In this directory, modify two files, one is postgresql.conf, one is pg_hba.conf, and finally restart
Modify postresql.conf
listen_addresses = ‘*‘ # Modify the configuration here to allow links to any address postgresql
Modify pg_hba.conf
host all all 0.0.0.0/0 trust # Configure the server to allow authentication
Restart postgresql
brew services restart postgresql
#Start the service can also use pg_ctl -D / usr / local / var / postgres -l /usr/local/var/postgres/server.log start
#Stop service pg_ctl -D / usr / local / var / postgres stop -s -m fast
#Export pg_dump database_name> sql_file
Test if it can be accessed remotely
psql -U username -h ip -p port dbname
Mac installs postgresql by default, how to make postgresql remotely accessible
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.