Docker Community Forums

Share and learn in the Docker community.

Access to docker mysql from host

Hi,

I am trying to acces to my localdatabase from my dockercontainer,

My host is a windows based machine and my container is an image of mysql;

docker run -it --net=host --name container1 mysql /bin/sh

mysql -h ‘local_host_ip’ -P 3306 -uroot -p

But It doesnt access to my local databases, this one is empty

mysql> show databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
±-------------------+
1 row in set (0.00 sec)

How can I access the one on the hos machine?

Thank You.

Looks like an issue with permissions. Check the privileges you have set. And then you should probably not work as root on the database, but create another user and give him exactly the permissions he needs.