Connecting remote mySQL server failed, I did make sure the MySQL is running, that Django can connect successfully, but want to connect python with mySQL failed
- the python code (run in google colab)
```
import mysql.connector
mydb = mysql.connector.connect(
host="196.xxx.xxx.xxx",
user="xxxxx",
passwd="xxxxxx",
database="Unnamed" # I tried to put "cloud_db" and "Unnamed" is not work
)
mycursor = mydb.cursor()
mycursor.execute("SELECT * FROM webpage")
myresult = mycursor.fetchall()
for row in myresult:
print(row)
```
- error output
```
---------------------------------------------------------------------------
MySQLInterfaceError Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/mysql/connector/connection_cext.py in _open_connection(self)
267 try:
--> 268 self._cmysql.connect(**cnx_kwargs)
269 self._cmysql.converter_str_fallback = self._converter_str_fallback
MySQLInterfaceError: Can't connect to MySQL server on '196.xxx.xxx.xxx:3306' (113)
The above exception was the direct cause of the following exception:
DatabaseError Traceback (most recent call last)
4 frames
/usr/local/lib/python3.8/dist-packages/mysql/connector/connection_cext.py in _open_connection(self)
271 self.converter.str_fallback = self._converter_str_fallback
272 except MySQLInterfaceError as err:
--> 273 raise get_mysql_exception(
274 msg=err.msg, errno=err.errno, sqlstate=err.sqlstate
275 ) from err
DatabaseError: 2003 (HY000): Can't connect to MySQL server on '196.xxx.xxx.xxx:3306' (113)
```
**when I connect Django and mySQL the following info is working**, but stock on python to MySQL connection
[![enter image description here][2]][2]
[1]: https://i.stack.imgur.com/eKxE2.png
[2]: https://i.stack.imgur.com/DPTJq.png