mysql - El Capitan 上的 Laravel Homestead/mysql 无法连接

标签 mysql laravel vagrant osx-elcapitan

自从升级到 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/

相关文章:

laravel - 如何将 firebase token 传递给 Laravel 应用程序?

windows-7 - 获取在Vagrant VM(在Windows 7主机下)上运行的LAMP堆栈的完整说明?

mysql - 索引组的排序

php - mysqli_query() 期望参数 1 为 mysqli,给定为 null

php - MYSQL数据库插入数据并在网页中显示

mysql - 先获取最后一条记录,其余按升序排列

mysql - 难以获取前 3 名学生的详细信息 谁迟到了

php - 在两个表中搜索并检索主表结果: Laravel

reactjs - 如何使用 Vagrant VM 通过共享文件夹启用热重载?

ssh - 向 vagrant 添加自定义 ssh key