自El Capitan以来,通过Vagrant连接到MySQL不再工作了

时间:2015-10-06 15:12:09

标签: mysql macos ssh vagrant

我正在使用vagrant,我正在使用以下配置连接到我的数据库。

enter image description here

SSH密码是private_key文件夹中的/.vagrant/machines/default/virtualbox/文件。这没有任何问题,但由于我已经更新到El Capitan,我无法连接。

我正在获取这些细节

  

Querious无法创建SSH连接,因为远程主机拒绝了权限。

     

仔细检查SSH用户名和密码(或公钥,如果使用基于密钥的身份验证)是否正确。

OpenSSH_6.9p1, LibreSSL 2.1.7
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 2222.
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/tzfrs/work/Server/194.6.226.31/.vagrant/machines/default/virtualbox/private_key type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/tzfrs/work/Server/194.6.226.31/.vagrant/machines/default/virtualbox/private_key-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4+deb7u2
debug1: match: OpenSSH_6.0p1 Debian-4+deb7u2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 127.0.0.1:2222 as 'vagrant'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr umac-64@openssh.com none
debug1: kex: client->server aes128-ctr umac-64@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:kBFNbCLWp1m4X03xMWxWeCjaQUEa426OsJ5IC/PNisM
debug1: Host '[127.0.0.1]:2222' is known and matches the RSA host key.
debug1: Found key in /Users/tzfrs/.ssh/known_hosts:11
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/tzfrs/work/Server/194.6.226.31/.vagrant/machines/default/virtualbox/private_key
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: Device not configured
debug1: permanently_drop_suid: 502
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.

作为请求,这是vagrant ssh-config

的输出
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/tzfrs/work/Server/194.6.226.31/.vagrant/machines/default/virtualbox/private_key
  IdentitiesOnly yes
  LogLevel FATAL

我需要做些什么才能让它再次发挥作用?

1 个答案:

答案 0 :(得分:1)

我有同样的问题,在Vagrant框中与PSequel连接到Postgresql数据库。同一解决方案的两种变体:

Vagrant key

  • 执行vagrant ssh-config
  • 您会看到一行包含/Users/stefbastiaansen/vm/precise-pangolin/.vagrant/machines/default/virtualbox/private_key
  • 之类的内容
  • 在新的终端窗口中连接到ssh -p 2222 -i /Users/yourusername/vm/precise-pangolin/.vagrant/machines/default/virtualbox/private_key vagrant@127.0.0.1
  • 您将收到无法确认主机(127.0.0.1:2222)的真实性的通知,以及您是否确定要继续连接的问题。回答是。
  • 然后打开PSequel(Postgres)或Sequel Pro(MySQL)并将其配置为SSH隧道。

    • 主持人:127.0.0.1
    • 港口:2222
    • 用户:vagrant
    • 身份文件:/Users/yourusername/vm/precise-pangolin/.vagrant/machines/default/virtualbox/private_key
  • 连接

您自己的密钥

  • 将您的公钥复制到剪贴板:pbcopy < ~/id_rsa.pub
  • ssh vagrant
  • 将您的公钥添加到流浪者框上的~/.ssh/authorized_keys
  • 打开一个新的终端窗口
  • ssh -p 2222 vagrant@127.0.0.1
  • 您将收到无法确认主机(127.0.0.1:2222)的真实性的通知,以及您是否确定要继续连接的问题。回答是。
  • 然后打开PSequel(Postgres)或Sequel Pro(MySQL)并将其配置为SSH隧道。

    • 主持人:127.0.0.1
    • 港口:2222
    • 用户:vagrant
    • 身份档案:〜/ .ssh / id_rsa
  • 连接

这是在您通过ssh连接之前需要进行的确认步骤。