mysqlmysql-workbenchssh-tunnel

mysql could not connect the SSH tunnel -> access denied for 'none'


I have a server which I can only access via SSH, I have installed MySQL on this server. And created a remote user so I could develop using mySQL workbench, but when try to SSH using MySQL workbench GUI I get the following error: Could not connect the SSH tunnel Authentication that can continue public key.

I'm able to connect to the user from the server itself and that works without any problems, I've checked the privileges and remote access seems to be activated for this user:

+------------------+-----------+
| user             | host      |
+------------------+-----------+
| developer        | %         |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+

I've filled in the following:

SSH Hostname <server-IP>
SSH username root
SSH password <clear>
SSH Key File <privat key file>

MySQL Hostname 127.0.0.1
MySQL Server Port 3306
Username <user>
Password <password>
Default Schema <empty>

Solution

  • I had a similar issue connecting to MySQL and wanted to share my solution in case anyone else ends up here.

    The issue occurred in two different scenarios.

    Scenario one: I gained access to the MySQL database successfully using a private key generated by my server (I am using CPanel). I deleted the corresponding public key (mistakenly) from my server then tried to re-connect and received the error.

    The solution here of course was to regenerate the keys.

    Scenario two: I try to access the MySQL database using an OpenSSH generated private key. I set the location of the key to C:/Users/username/.ssh/id_rsa and received the error.

    The solution here was to convert the OpenSSH private key to an RSA private key.

    ssh-keygen -p -m PEM -f C:/Users/username/.ssh/id_rsa
    

    Make sure you backup your OpenSSH private key beforehand as this will override id_rsa.

    I was then able to connect to the MySQL server using the RSA private key.

    You can distinguish between the two types of keys by viewing them in any text editor and reading the first line. It will say either OPENSSH or RSA.