问题
I wrote a few lines of code that sends data to a remote MySQL database.
import MySQLdb
db = MySQLdb.connect("MyServerIP","MyUserName","MYPwd","MyDB")
# prepare a cursor object using cursor() method
cursor = db.cursor()
# execute SQL query using execute() method.
cursor.execute("INSERT INTO mytable(Column1) VALUES (Value1);")
# Fetch a single row using fetchone() method.
data = cursor.fetchone()
# disconnect from server
db.close()
Error:
Can't connect to MySQL server (111)
I tried:
Putting in comment: bind-address: Doesn't work.
Changed bind-address initial value to my server IP: Doesn't work.
Any help?
来源:https://stackoverflow.com/questions/38780631/cant-connect-to-mysql-server-111-even-after-changing-bind-address