php – How to connect my host mysql in docker container?

exception or error:

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

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *