Jun-02-2020, 07:15 PM
(This post was last modified: Jun-02-2020, 07:15 PM by kenwatts275.)
Hello all,
I am trying to connect to MariaDB on my LINUX server from my PC using the Python mysql.connector.
I can connect to the server via ssh so I know the IP address (10.0.0.117) is correct.
When I log into the server and run the same script (with "localhost" as the hostname) it works fine.
However, when I run the script from my PC, it gives the following error:
I am trying to connect to MariaDB on my LINUX server from my PC using the Python mysql.connector.
I can connect to the server via ssh so I know the IP address (10.0.0.117) is correct.
When I log into the server and run the same script (with "localhost" as the hostname) it works fine.
However, when I run the script from my PC, it gives the following error:
Error:2003: Can't connect to MySQL server on '10.0.0.117:3306; (116 Connection timed out)
Below is the Python script. Any help would be appreciated.from tkinter import * import mysql.connector from tkinter import messagebox hostname = "10.0.0.117" username = "username" password = "password" try: mydb = mysql.connector.connect( host=hostname, user=username, passwd=password ) if mydb.is_connected(): dbinfo = mydb.get_server_info() msg_text = "Connected to SQL database "+dbinfo messagebox.showinfo("Information",msg_text) except mysql.connector.Error as e: msg_text = "Cannot connect to SQL database "+str(e) messagebox.showerror("Error",msg_text)