Connecting to dockerized MySQL database on Laravel App

  docker, laravel, mysql, php

For the first time I wanted to use Docker for my Laravel project and I just created the app with newest Laravel 8. I’m using Laravel Sail for starting the Docker. For now, thing goes pretty well, but I don’t know how to connect on MySQL database.

When I start docker with command "sail up", after that how can I make connection on MySQL database with Navicat for example, or even on phpmyadmin?

This is .env content for MySQL:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=db_example
DB_USERNAME=root 
DB_PASSWORD=

Source: Docker Questions

LEAVE A COMMENT