Mac installs PostgreSQL by default, so that PostgreSQL can be accessed remotely

Source: Internet
Author: User
Tags postgresql psql
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

#Import sql file psql -d database_name -f sql_file

#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

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.