0

I am using Laravel Sail/ Docker for the first time. I have got my site running fine but the issue is that I cannot access the DB via a GUI (Sequel Pro). I have added the default credentials from my env but cannot access. But seem to be able to run php artisan migrate. Does anybody have any tips for how I can debug this?

This is my .env file:

DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=my-db
DB_USERNAME=sail
DB_PASSWORD=password
peco60052
  • 29
  • 6
  • https://laravel.com/docs/8.x/sail#mysql "By default, the MySQL database is accessible at `localhost` port 3306." – lagbox Dec 12 '21 at 16:06
  • I have tried that, so user - sail, password - password, host - localhost(127.0.0.1) but no joy. This is in my SequelPro settings. Then set the env file to have host as mysql – peco60052 Dec 12 '21 at 16:16
  • @peco60052 after ``sail up`` make sure mysql container is running using ``docker ps`` then take a look at ``docker-compose.yml`` file to find out which port mysql is running. I use datagrip to connect to localhost:3306 with specified credentials. – AmirRezaM75 Dec 12 '21 at 19:24
  • Have the exact same problem and was about asking. I tried the suggestion here (https://stackoverflow.com/questions/65761142/cant-connect-to-database-laravel-sail ) setting FORWARD_DB_PORT=3306 but the container started throwing errors. Perhaps @peco60052 can try and see if it works. – user1729972 Dec 13 '21 at 09:54

2 Answers2

0

The solution for you might be in the last comment here by Lorenzo Franzone: changing the SequelPro version.

Rather than this though, I dropped the version of MySQL in docker-compose from 8.0 to 5.7 to work with my very old version of SQLYog and: Bingo! It worked.

user1729972
  • 712
  • 2
  • 9
  • 29
0

Simple, you must change DB_HOST=mysql to DB_HOST=127.0.0.1 Have a good day.