0

I need an old version of Mysql Server : 5.1.73

I would like to use it inside a container, but I can't find an image since the first version available is 5.5. So I decided to install a CentOS 6 image and then install Mysql 5.1.73 using yum.

At then end I have a container with CentOS 6 and Mysql installed and configured according to my needs. At this step I commit the image in order to run the container.

I try the following command :

docker run -p 3307:3306 --name test-mysql --mount source=databases-vol,target=/databases -d centos6-mysql

But when I try to connect to my database I have an error message like this :

MySQL said: Host '172.17.0.1' is not allowed to connect to this MySQL server

What did I miss ?

gduh
  • 1,079
  • 12
  • 30
  • 1
    Post your Dockerfile – Elroy Jetson May 06 '19 at 20:24
  • You most likely do not have permissions to connect. You will have to create a user and grand permissions – Elroy Jetson May 06 '19 at 20:26
  • Possible duplicate: https://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server – Elroy Jetson May 06 '19 at 20:26
  • @Elroy I already create a user with host corresponding and grant permissions, but it did not change anything. – gduh May 07 '19 at 06:49
  • @Elroy, exploring your link, I try to create a user with `host=%` instead of the ip address and mask and it's ok like that, but I don't understand why the ip/mask does not work. – gduh May 07 '19 at 07:02

1 Answers1

0

by default.. mysql doesnt allow connections from remote host (even though you have docker container your machine is remote host)

this may work..

Login to docker and grant remote access..

$ docker exec -it mysql_singstep bash
# mysql -h localhost -u root -p

https://medium.com/@gchandra/install-mysql-8-using-docker-easily-10091d575441

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Ganesh Chandrasekaran
  • 1,578
  • 12
  • 17