I have a docker container up and running. When I log in to the container and try to connect to MySQL using python SQL connector I am not able to connect. I am trying to connect using the internal IP after changing the bind-address properties of running MySQL on the host system.
Error
mysql.connector.errors.DatabaseError: 2003 (HY000): Can't connect to MySQL server on '****' (113)
Count2.py
import mysql.connector
cnx = mysql.connector.connect(user='root', password='root',
host='172.31.37.139',port=3306,
database='test')
Docker command
sudo docker run -it -d -p 4040:4040 -v $(pwd)/count2.py:/count2.py d9e1d42543f9 bin/spark-submit --jars /usr/spark-2.4.1/mysql-connector-java-5.1.49/mysql-connector-java-5.1.49.jar --class com.mysql.jdbc.Driver /count2.py
Can someone help me here?