![]() |
Connection timed out error when connecting to SQL server - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Connection timed out error when connecting to SQL server (/thread-27307.html) |
Connection timed out error when connecting to SQL server - kenwatts275 - Jun-02-2020 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: 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) RE: Connection timed out error when connecting to SQL server - menator01 - Jun-02-2020 Did you open the port on your router for your database? RE: Connection timed out error when connecting to SQL server - bowlofred - Jun-02-2020 https://www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql |