自从升级到 El Capitan 以来,我一直无法连接到 Homestead 实例上的 mysql。 Macbook Air 和 Macbook Pro 上都会出现这种情况,并且在这两台机器上我都将 Vagrant、VirtualBox 和 Homestead 更新到了最新版本。
我已经删除了我的 .vagrant-d
目录并销毁/重新启动了我的 Homestead 盒子。
我尝试过使用 SQLPro 和 mysql workbench —— 都无法连接。
SQLPro 的错误是:
Unable to connect to host 127.0.0.1, or the request timed out.
Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).
MySQL said: Can't connect to MySQL server on '127.0.0.1' (4)
从命令行我也无法连接,并出现以下错误:
➜ ~ mysql -h 127.0.0.1 -u homestead -psecret -P 33060
Warning: Using a password on the command line interface can be insecure.
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0
这个问题基本上已经影响了我近一周的工作效率。我几乎尝试了所有我能想到的方法。我的 SSH key 很好,因为我可以通过 SSH 进入 Homestead 盒子,并且我知道 mysql 正在那里运行,因为我可以从 SSH session 中连接到 mysql。
有人知道如何连接或至少解决这个问题吗?
谢谢!
最佳答案
编辑/etc/mysql/my.cnf
并添加配置选项skip-name-resolve
就成功了!
关于mysql - El Capitan 上的 Laravel Homestead/mysql 无法连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33685481/