Allow external connection to the database

Asked

Viewed 48 times

0

Guys I have a problem accessing a database that is in a Virtual Machine.

I have a machine A that has an application Laravel all configured and the project installed, and has another machine B where is my database, which is also configured.

In the archive .env is using the default VM settings. I read some tutorials to free up access to the bank, inside the archive pg_hba.conf and the file postgresql.conf. In these files I made the default to free the access, but when access the on the machine A and execute the command php artisan migrate an error appears and connection timeout and I can’t connect to the database.

What is the possible solution for this ?

  • And what modifications have you made to pg_hba.conf and in the postgresql.conf specifically for this purpose?

  • 1 . in the archive /etc/postgresql/9.6/main/postgresql.conf #listen_addresses = 'localhost' for listen_addresses = '*' 2 . in the file /var/lib/postgresql/9.6/pg_hba.conf add next line at the end of the file host all all 0.0.0.0/0 md5

  • Ai with these settings was to have remote access.

  • Reload the configuration files? For example with: select pg_reload_conf();.

  • I don’t think so, I’ll check.

  • How would I do that ?

  • I made the service postgres restart

  • It worked, it was just the server IP that was wrong, I gave a sudo ifconfig.

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.