Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

connect mysql in docker

Hello I had succsfully connected the small mysql database to virtual machine. However when I try to establish connection into the docker container I am unable to make it work.

I can connect to mysql in virtual machine as below

 

mysql -h 34.78.131.144 \

    -u root -p

 

It opens succesfully and then when I query mysql database from the machine I get 

User  root@34.147.7.30 Port 3306

 
I create database 

 

CREATE DATABASE IF NOT EXISTS picai_hp_36

 

Now in this virtual machine I run docker container like this 

 

sudo docker run --init --ipc host --privileged --net host  -p 88:88 -p 3306:3306 -p 8888:8888 -p49053:49053 -v /mnt/disks/sdb:/home/sliceruser/data  -it  slicerpicai:latest bash

 

and use connection string in the container like this

 

 

mysql://root@34.147.7.30:3306/picai_hp_36

 

then I get error

 

(MySQLdb.OperationalError) (2003, "Can't connect to MySQL server on '34.147.7.30:3306' (110)")

 

 

0 1 1,147
1 REPLY 1

You can get help in this MySQL post. Also, you should try to look for a more accurate consult in the Docker Community Forum, and this and this other Stack Overflow posts may be helpful.