Can't connect to MySQL server (111) even after changing bind-address

孤人 提交于 2020-01-24 20:45:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!