MySQL Workbench(版本 6.0.8)SSH 身份验证问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21527743/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 19:58:43  来源:igfitidea点击:

MySQL Workbench (version 6.0.8) SSH Authentication Issue

mysqlsshmysql-workbenchcentos6

提问by Hei

I am trying to connection to a MySQL server on Host X through machine Y over SSH.

我正在尝试通过 SSH 通过机器 Y 连接到主机 X 上的 MySQL 服务器。

The same setup (but older version of MySQL workbench) works on my another box (CentOS 6.3).

相同的设置(但较旧版本的 MySQL 工作台)适用于我的另一个机器(CentOS 6.3)。

However, the same setup doesn't work on my CentOS 6.5.

但是,相同的设置在我的 CentOS 6.5 上不起作用。

I tried to use the SSH key for authentication between my box and machine Y over SSH, and it works when I ssh from my box to machine Y.

我尝试使用 SSH 密钥通过 SSH 在我的机器和机器 Y 之间进行身份验证,当我从我的机器 ssh 到机器 Y 时它可以工作。

However, MySQL workbench gave me the following error: ERROR Could not establish SSH connection: Bad authentication type (allowed_types=['publickey', 'gssapi-with-mic']).

但是,MySQL 工作台给了我以下错误:错误无法建立 SSH 连接:身份验证类型错误(allowed_types=['publickey', 'gssapi-with-mic'])。

Some people suggested that I set AllowTcpForwarding to yes in /etc/ssh/sshd_config, which I did, restarted the service and rebooted my machine.

有人建议我在 /etc/ssh/sshd_config 中将 AllowTcpForwarding 设置为 yes,我这样做了,重新启动了服务并重新启动了我的机器。

But I still got the same error.

但我仍然遇到同样的错误。

Any idea?

任何的想法?

It seems like for some reason the .ssh/id_dsa key isn't picked up when MySQL workbench attemtps to connect.

似乎由于某种原因,当 MySQL 工作台尝试连接时, .ssh/id_dsa 密钥没有被拾取。

Thanks in advance.

提前致谢。

回答by user3938452

You need to ensure that your private key is in openssh format. With puttygen you can export as Openssh. This worked for me.

您需要确保您的私钥采用 openssh 格式。使用 puttygen,您可以导出为 Openssh。这对我有用。

回答by Sohan

Converting it to OpenSSH solves the issue. Just do the following:

将其转换为 OpenSSH 解决了这个问题。只需执行以下操作:

  1. Open Putty Key Generator.
  2. Load the private key by going to File - > Private Key from the location you saved the private key file in - you should see your key loaded in Putty.
  3. Now go to conversations and export to Openssh - save the file in a safe location.
  4. Go to Workbench and under SSH key file point it to the new Openssh file instead of the old private key file. this should solve your problem.
  1. 打开腻子密钥生成器。
  2. 通过从您保存私钥文件的位置转到文件 - > 私钥来加载私钥 - 您应该看到您的密钥已加载到 Putty 中。
  3. 现在转到对话并导出到 Openssh - 将文件保存在安全位置。
  4. 转到 Workbench 并在 SSH 密钥文件下将其指向新的 Openssh 文件而不是旧的私钥文件。这应该可以解决您的问题。

回答by Phil

I've just come across this again recently. If you use a password protected private key and you just upgraded to macOS Sierra you probably need to re-add your private key to your keychain again.

我最近又遇到了这个。如果您使用受密码保护的私钥并且您刚刚升级到 macOS Sierra,您可能需要再次将您的私钥添加到您的钥匙串中。

ssh-add -K ~/.ssh/id_rsa

This instantly fixed the problem for me.

这立即为我解决了问题。

回答by Rodney

For Linux users using ssh-keygen:

对于使用 ssh-keygen 的 Linux 用户:

As per the other answers you need to use openssh format.

根据其他答案,您需要使用 openssh 格式。

ssh-keygen -o -b 4096

That gives me a new keypair RSA type 4096 bits in openssh format. It's the -othat's key here (no pun intended).

这给了我一个 openssh 格式的新密钥对 RSA 类型 4096 位。这是-o这里的关键(没有双关语)。

Obviously this generates a newkey so is only useful if you can upload the new public key to the server. Don't forget to back up your old keys first incase you use them elsewhere.

显然,这会生成一个密钥,因此只有在您可以将新公钥上传到服务器时才有用。不要忘记先备份您的旧密钥,以防您在其他地方使用它们。

AFAIK ssh-keygen doesn't have the ability to convert an existing key.

AFAIK ssh-keygen 无法转换现有密钥。

Why Oracle have dropped support for the ubiquitous PEM format is beyond me.

我无法理解为什么 Oracle 放弃了对无处不在的 PEM 格式的支持。

回答by Babak Momeni

I had the same problem on macos with both Navicat and MySQL Workbench. Thanks to Jonathan on this article

我在使用 Navicat 和 MySQL Workbench 的 macos 上遇到了同样的问题。感谢乔纳森在这篇文章中

figure my issue out. Macos users first need to install puttygen and then convert ppk format into pem by means of Jonathan said in his tutorial and then TADA! everything works like a charm!

弄清楚我的问题。Macos 用户首先需要安装 puttygen,然后通过 Jonathan 在他的教程中说的方式将 ppk 格式转换为 pem,然后是 TADA!一切都像魅力一样!

回答by web_developer

I spent 3-4 days to figure out and tried many different solution but none of them worked for me except following.

我花了 3-4 天的时间找出并尝试了许多不同的解决方案,但除了以下之外,没有一个对我有用。

I was on Windows and using XAMPP to run MySQL and localhost. I stopped both services on my machine and then tried to connect SSL connection using Workbench and its connected.

我在 Windows 上使用 XAMPP 来运行 MySQL 和 localhost。我在我的机器上停止了这两个服务,然后尝试使用 Workbench 连接 SSL 连接及其连接。

回答by cyril

for linux and generally for workbench it must to be in pkcs8 format intead of rfc...

对于 linux 和通常对于工作台,它必须是 pkcs8 格式而不是 rfc ...

so export in OpenSSH format but in pkcs8

所以以 OpenSSH 格式导出,但以 pkcs8 格式导出