If you would like to access a postgresql database installed on a remote machine using psql. Follow these steps to enable it.
1. Modify the /var/lib/pgsql/9.5/data/pg_hba.conf file.
Change the IPv4 and IPv6 local connections to: host all all all trust
2. Modify the /var/lib/pgsql/9.5/data/postgresql.conf file.
Uncomment and change listen_addresses = 'localhost' to listen_addresses = '*'.
3. Add a rule to the iptables if the port is not open. In most cases you do not need to do this.
---------------------------------------------------------------------------------------------------
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.
1. Modify the /var/lib/pgsql/9.5/data/pg_hba.conf file.
Change the IPv4 and IPv6 local connections to: host all all all trust
2. Modify the /var/lib/pgsql/9.5/data/postgresql.conf file.
Uncomment and change listen_addresses = 'localhost' to listen_addresses = '*'.
3. Add a rule to the iptables if the port is not open. In most cases you do not need to do this.
iptables -A INPUT -s 0/0 -p tcp --dport <your port> -j ACCEPT
4. On a remote machine.
psql -U postgres -h <database host IP address> -p <database port>
If you don't want to type the IP address each time, you can set a PGHOST=<database host IP address> environmental variable to bypass it.
---------------------------------------------------------------------------------------------------
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.
No comments:
Post a Comment