Question

I am trying to log into PostgreSQL on my EC2 server via SSH using Navicat.

I get the following error message:

"80070007: SSH Tunnel: Socket error on connecting. WSAGetLastError return 10061($274D)"

On the server, the "role" postgres already exists, and there is already a database called postgres. I have assigned a password to postgres (using ALTER NAME command via Putty).

The SSH settings I am using in Navicat are: Port: 5432 User Name: [admin user name] Authentication Method: Public Key

The Connection settings are: Host Name: localhost Port: 3306 Initial Database: postgres User Name: postgres Password: [password]

When I connect to the MySQL server on the same machine, the settings are exactly the same except for:

SSH to Port 22 User Name (for connection): root (with corresponding password)

I have tried the SSH to port 22, in which case the error message is:

"could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" and accepting TCP/IP connections on port 60122? received invalid response to SSL negotiation:4"

Any ideas on what settings I need to change to get this to work?

Was it helpful?

Solution

Your config seems to be very wrong.

ssh port should be not 5432, but 22 (ssh default).

postgresql port should be not 3306 (this is actually MySQL), but 5432 (postgres default)

To verify your setup, try ssh-ing into your EC2 instance manually. After you ssh in, check if you can execute "telnet localhost 5432". If you see an error immediately, that would mean that postgres server is not running. If you see nothing - this is good sign and means that Postgres is running. You can quit from this by Ctrl-], q, Enter.

Note that EC2 instances may require you to use ssh public key authentication (not a password). In this case, you will have to find option in Navicat to provide such a key.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top