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

10

27

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>
Rhadamanthus answered 4/12, 2020 at 14:20 Comment(0)
S
50

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.

Silverweed answered 23/1, 2021 at 6:3 Comment(5)
I got to give it to ya, your second scenario allowed me to connect. Had me literally pulling my hair. My private key was in OpenSSH format and MySQL Workbench doesn't like that. Thanks.Benedikta
My man, For the past 2-3 years I'd been running both the latest version of MySQL Workbench and also a 6.3 instance that I use to access a specific server with this problem. You've made my day.Dunkin
didn't work for me , regenerated keys about 4 times and tried solution 2, still same error.Wavelength
This worked for me as well. I had my keys in the format Acquia required, but for some reason MySQL workbench needed the key in the RSA format. Once I did this, I was able to connect.Alb
Worked for me too. Converted the key from OpenSSH to RSA and the connection went through without any problem.Claudell
E
33

For those who, like me, were trying to connect through a SSH key generated by PuTTY:

  1. Open the private key with PuTTYGen. It'll ask for the private key password.
  2. Go to Conversions->Export OpenSSH Key menu.
  3. It'll ask for the file name to assign to the converted OpenSSH key. Give it a different name than the PuTTY private key one you started with.
  4. In MySQL Workbench use the converted key as "SSH Key File". When asked, enter the private key password.
  5. At this point it should connect.
Exurbanite answered 19/2, 2022 at 20:4 Comment(3)
This solution worked for me. Workbench didn't like the RSA key I generated, but exporting it as OpenSSH did the trick. thank you!Kentkenta
Thanks mate :) I was trying to opening that .pem and .ppk turns out it needs the ssh >.< .Castroprauxel
This worked for me with step 3 saved as a ppk file.Crat
W
9

For me it was actually vice versa - my key was an RSA private key, and had to convert it to OpenSSH. Then MySQL Workbench connected successfully. I guess whoever has a similar problem it may be wort to try to convert the private key either way.

Wistrup answered 3/4, 2021 at 17:44 Comment(4)
I've been fighting that off and on all day. It was exactly what I needed to get MySQL Workbench to connect.Duckweed
How did you convert from RSA to OpenSSH? Would be nice, if you would add this code snippet to your solution.Blackheart
How, why don't you explain what you did?Wavelength
See "Dario Fumagalli"s answer - I've done exactly these steps.Wistrup
S
6

in my case, there was a problem when i select id_rsa.pub instead id_rsa, so when i select id_rsa problem dissaper!

Scrummage answered 12/4, 2021 at 10:35 Comment(0)
F
1

For my case using with mysql workbench 8.0 required new openssh key format. so when you generate openssh format. Make sure you generate new format and then provide that key for sshkey

Frederickson answered 31/8, 2022 at 8:52 Comment(0)
I
0

For me, this had to do with user:group. Instead of having the file as root:root, I did a chown to localuser:localuser and it worked fine.

Ingenuity answered 2/2, 2023 at 0:3 Comment(1)
What file are you referring to?Delcine
S
0

My case was strange. I had been successfully making the connection for years.
It seems they changed the format for (new) master password to the server my website & database are on.
While my password still worked for connecting via FTP, MySQL Workbench could not connect to the database. Oddly once I clicked to "edit" the master password on my server, I saw that the current password did not match their new password requirements.
Updating the master server password (everywhere) fixed the issue. Password for MySQL did not need to change.
Turns out that I was not even using a putty generated key for this particular connection, despite the message. I found it strange that the password worked everywhere, except for connecting to the database via Workbench. Had it worked nowhere, I probably would have tried resetting the password earlier, and was dumbfounded as to why the technically correct, working everywhere else, password wouldn't work (stopped working) with Workbench.
Anyway, this is at lease a note to myself in case I ever run across a similar strangeness again.

Sammons answered 11/7, 2023 at 21:58 Comment(0)
I
0

The issue I faced, where I received the error message "Access denied for 'none'. Authentication that can continue: publickey,password" during SSH connection, was due to not having my public key in the ~/.ssh/authorized_keys file on the server. Adding the public key to this file resolved the problem in my situation.

Induplicate answered 20/5 at 7:5 Comment(1)
This anwere contains a lot of "when I was a child" informations :) It slightly provides a possible solution. Be more strict to the problem and try to not post a bunch of experiences if possible. Shothand, keep it as simple as possibleBradway
J
-1

May be it is caused by the version. For example, if you use workbench 5.7 to connect the remote mysql server 5.1, than the connection can not be build. However, if you use command line, mysql -uroot -proot -h remote_mysql_ip, it worked. Then, you can use the IDE datagrip from jet brains. It will hint you the version issue, and you should download the mysql-5.1 jdbc connection jar file for connection.

Junitajunius answered 20/5, 2023 at 2:5 Comment(0)
W
-2

I had to remove the passphrase from my key file to allow MySQL Workbench to use it.

Wifely answered 27/1, 2022 at 14:49 Comment(1)
This is dangerous, should use ssh-agent with ssh-add instead.Pickering

© 2022 - 2024 — McMap. All rights reserved.