Skip to content Skip to sidebar Skip to footer

Can You Connect To A Database On Another Pc?

I'm using MySQLdb for python, and I would like to connect to a database hosted on an other PC on the same network/LAN. I tried the followings for host: 192.168.5.37 192.168.5.37:

Solution 1:

You can use MySQL Connector/Python, a standardized database driver for Python.
You must provide username, password, host, database name.

import mysql.connector

conn = mysql.connector.connect(user=username, password=password,
                          host="192.168.5.37",
                          database=databaseName)
conn.close()

You can download it from: https://dev.mysql.com/downloads/connector/python/


Solution 2:

The IP you posted are local IPs Give it a try with your external IP (for example on this website) https://www.whatismyip.com/

If it works with the external IP, then it's maybe a misconfiguration of your firewall.


Post a Comment for "Can You Connect To A Database On Another Pc?"