2

I have two servers. For example1.com and example2.com

At example1.com server I have my php code and example2.com there is a postgreSQL database.

Now I want to connect postgreSQL through a tunnel in example1.com

I tried the following command at example1.com server.

ssh -L 5433:localhost:5432 [email protected]

Then it will prompt for password and I enter the password and login to ssh, then I am trying to connect to database localhost:5433 post but I am getting 'password authentication failed'.

How do I connect to example1.com through ssh?

3
  • it seems there is issue with postgresql configuration setting. check listen_addresses setting in postgresql config file Commented May 12, 2016 at 18:00
  • Are you trying to connect to the database localhost:5433 on the SSH session to example2.com, or from your example1.com server? Are you connecting from PHP or from psql? Commented May 13, 2016 at 3:45
  • i am trying to connect to database through localhost:5433 through php. Commented May 13, 2016 at 4:53

1 Answer 1

1

You need to check the pg_hba.conf on your PostgreSQL server. It probably requires password authentication for TCP/IP connections coming from localhost. So you either need to change that, or set a password for your database user and enter that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.