How to connect my host mysql in docker container?

kablanfatih :

my.cnf configured = bind-address = 172.18.0.3(Docker Container ID) and bind-address = 0.0.0.0 in my host. I try connecting from docker container.

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

But not connecting local mysql.I get this error

SQLSTATE[HY000] [2002] Connection refused

Arun s :

If you want to connect to your local database , you call give host.docker.internal in the place where we provide database url . Then give the db you want to specify along with db username and db password.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=11843&siteId=1