Connecting local MySQL database inside a Docker container?

0

Issue

Here is how I am trying to connect. But it shows:

Host ‘host.docker.internal’ is not allowed to connect

YAML:

 environment:
       - MYSQL_DSN=mysql:host=192.168.0.1;port=3307;dbname=dbname

Solution

Your MySQL user does not allow external connections.

Update your user to allow external connections using "GRANT" or create a new user using "CREATE USER": https://linuxize.com/post/how-to-create-mysql-user-accounts-and-grant-privileges/

To accept all connections, use % wildcard as a host part.

Answered By – Camille

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More