Reputation: 513
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
Upvotes: 2
Views: 814
Reputation: 945
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.
Upvotes: 3
Reputation: 1627
ip route show | awk '/default/ {print $3}'
inside your container and check the ip address. try to connect on this IP address and port 3306.Upvotes: 0