我正在尝试访问cpanel数据库并进行远程记录。我将以下代码用于sql连接,已在面板“ 远程MySql ”中添加了“ %”,以允许任何ipaddress远程访问数据库。但仍然出现此错误
import pymysql
# Open database connection
db = pymysql.connect("serverIpAddress","User","Password","DatabaseName")
# prepare a cursor object using cursor() method
cursor = db.cursor()
# execute SQL query using execute() method.
cursor.execute("SELECT VERSION()")
# Fetch a single row using fetchone() method.
data = cursor.fetchone()
print ("Database version : %s " % data)
# disconnect from server
db.close()
我收到此错误:
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '184.164.144.130' (timed out)")