Connecting to Sequel Pro with Homestead issues

我是研究僧i 提交于 2021-01-29 10:47:14

问题


I have been checking out a lot of answers here and on GitHub regarding this issue, but whatever I try there is always something wrong. I also don´t get why with the same credentials sometimes I am able to connect other times I am not even able to do that.

So right now I get the following error:

"SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known

and I am not able to connect:

My .env credentials:

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

My database.php

'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST'),
            'port' => env('DB_PORT'),
            'database' => env('DB_DATABASE'),
            'username' => env('DB_USERNAME'),
            'password' => env('DB_PASSWORD'),
            'unix_socket' => env('DB_SOCKET'),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ],

...and for the standard connection, I use 192.168.10.10 for the host.


回答1:


I think your issue is with the DB_HOST parameter. I included a full explanation. Your fix is likely part of the final paragraph!

Laravel ships with a .env.example configured to connect to the Homestead MySQL out of the box. Assuming you are running everything in Homestead, and Homestead is configured properly, you should be able to use the following database configuration to connect successfully.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

If you are trying to connect to the Homestead database from outside of Homestead, the Laravel documentation describes how you can do that as well. You can check that out here.

Essentially what you need to do is connect to 127.0.0.1 as a host but use a different port (as opposed to 3306.) For MySQL, Homestead exposes a port 33060 that you should try to connect to instead. For Sequel Pro this should fix your issue!




回答2:


Updated October 2020

If you are using MySql 8 there are some issues with that.

I was also not able to connect with the Laravel Homestead DB. I solved the problem installing Sequel Ace, the successor of SequelPro which is available also on Mac AppStore.

https://github.com/Sequel-Ace/Sequel-Ace

Here a post from the SequelPro issues about:
https://github.com/sequelpro/sequelpro/issues/3705



来源:https://stackoverflow.com/questions/51920183/connecting-to-sequel-pro-with-homestead-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!