尝试使用 Sequel Pro 进入这个 Vagrant 盒子。错误详细信息屏幕是;
Used command: /usr/bin/ssh -v -N -S none -o ControlMaster=no -o ExitOnForwardFailure=yes -o ConnectTimeout=10 -o NumberOfPasswordPrompts=3 -o TCPKeepAlive=no -o ServerAliveInterval=60 -o ServerAliveCountMax=1 vagrant@control.example.dev -L 57790:127.0.0.1:3306
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Control socket " none" does not exist
debug1: Connecting to control.example.dev [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
ssh: connect to host control.example.dev port 22: Connection refused
一旦进入 ssh (vagrant ssh
),我就可以在命令行上登录 mysql。
我可以使用 mysql -uroot -p
进入,然后输入空白密码。
我在 Sequel Pro 上的连接是;
MySQL Host: 127.0.0.1
Username: root
SSH Host: control.example.dev
SH User: vagrant
其他都是空白!
最佳答案
我遇到了同样的问题。我已经销毁了我以前的 vagrant box 并使用相同的 IP 地址重建了它。尽管我的所有凭据都是正确的,但我一直遇到这个问题,如上图所示。
对我来说,解决方法是从 ~/.ssh/known_hosts
中删除 IP 记录。错误只是告诉我连接被拒绝,并且“隧道意外关闭”。
此问题的另一个解决方案是将您自己的 id_rsa.pub
key 添加到 VM 的 /home/vagrant/.ssh/authorized_keys
文件中。这将有效地让您访问您的虚拟机,就像您通常授予自己无密码 ssh 访问任何 Ubuntu 机器一样。
关于mysql - Sequel Pro 上的 SSH 访问不适用于 Vagrant,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34546578/