2👍
✅
Reading again your question, I have noticed the private_network
configuration. This makes that your guest host has that IP, so you should be able to connect to 192.168.33.33:5432. PostgreSQL is listening on 5432 in the VM. Careful, your host should be on the same network to be reacheable. If not, you will need to add static routes between your host and the VM.
The forwarded_port
option will map a port on your host with a port on your guest, so
config.vm.network "forwarded_port", guest: 5432, host: 3333
will map localhost:3333
(or any IP you have in your host) to 192.168.33.33:5432
.
About the pg_hba.conf
configuration, it prevents unauthorised accesses, but you can connect to the server, so the error message will differ.
Source:stackexchange.com