Connecting to Sequel Pro with Homestead issues

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.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 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!

Method 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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x