Can't connect to MySQL with SSH

I found out that remote MySQL connection is disabled on shared hosting servers for Namecheap, so I'm trying to connect with SSH.

Here is my configuration.


Screenshot 2024-11-13 203155

When I click "Test," I always get an error from Wappler stating "Error connecting: Timed out while waiting for a handshake." Not sure what I'm doing wrong here. I also tried port 5502 instead of 3306

Also, the authorization status shows "not authorized" in cPanel. Does this have something to do with the error?

Yes you need to authorise the key, from WHM/cPanel documentation:

Thank you. I tried authorizing the public key, but I'm still getting the same error
"Error connecting: Timed out while waiting for a handshake"

Try quitting Wappler and restarting. Also sometimes this error is shown but the database connection is actually fine, so after the restart see if you can query your database in Server Connect using just a basic query. Can also right click on the database and try 'Refresh Full Schema' within the Database Manager... See if that resolves the issue?

I know for sure my passwords are correct
I think my SSH user is correct
I'm confident my user & database are correct since I got it from here in cPanel


My host name for the SSH looks correct
Not sure about my host name for the connection
Not sure if my port is correct, but I tried both options (3306 & 5432) from here: https://www.namecheap.com/support/knowledgebase/article.aspx/1249/89/how-to-remotely-connect-to-a-mysql-database-located-on-our-shared-server/

Is for PostgreSQL.

Is for MySQL. Which is what you have selected in the Database Connection.

Oops, I meant 5522

Hmm, I tried restarting Wappler, but no luck

Here you are specifying that the database is local and not on a remote IP. The host should be the IP or address provided for your database by your host provider. You have mixed the two up, you are trying to connect to a local database using an SSH key which is stored remotely, this will not work. This is the reason for the error and the problem you are experiencing.

Check out the documentation for database connections:

https://docs.wappler.io/t/connecting-to-a-database/2873

1 Like

This may well be correct:

But this is wrong:

You need to enter the remote IP or address for the database, and its port based upon which database type you have created.

1 Like

It is worth taking a break for five minutes and having a coffee or a breath of fresh air. Then slowly have a read through the documentation to gain a grasp of how database connections work within Wappler. Might help having a look on YouTube for how to setup a remote connection to a database for your provider, am sure there will be a video on it, will certainly help you to understand the principles a little better and avoid a lot of frustration and head banging.

:slight_smile:

2 Likes

Thank you so much for the help! You're right, the host & port were incorrect.

Another problem I had was that I didn't realize I had to use a username/password for cPanel. I didn't even know I had one since Namecheap always redirected me to cPanel automatically. I was using the database login details, instead of the cPanel login details for the SSH connection

1 Like

You were using port 3306 for SSH tunneling, that wasn't correct. Usually it's port 22, but Namecheap might use a different port

3 Likes

Correct, the port is 21098 for Namecheap SSH tunneling

You now have everything working @Boost?

:slight_smile:

Yes!!! :smile: Thank you again so much!!!

1 Like

You are more than welcome! :slight_smile:

1 Like