I'm not sure if this is python question, or a mysql question, but I want to be able to connect to a mysql server on one of my laptops from another laptop using python. I intend to allow the laptop connecting to the server to be able to change anything inside the database when it is connected and to be able to get the information from the database to show onto a GUI. I have already made the GUI on the laptop that is hosting the mysql server and it works exactly how I want it to, but now I want an external laptop to do the same without hosting the server itself, and I plan on having multiple computers to do the same. I want to know what would be the best approach to do this because I have looked online, and I found out I can do this by downloading the mysql workbench and then connecting to the server from the workbench, but I want to be able to do this though python only. Below is an example of the code I use to connect to the mysql server. I'm also using pycharm just incase that helps.
import mysql.connector # make sure the python interpreter has 'mysql-connector-python' downloaded
# this sets up the connection to the mysql database where all the list information will be obtained from
mydb = mysql.connector.connect(host="xxx",
user="xxx",
passwd="xxx",
database="xxx"
)
mycursor = mydb.cursor()
mycursor.execute("select items from test where inuse = 0")
databaselistunsorted2 = [i[0] for i in # this makes the column turn its contents into a list for
mycursor.fetchall()]
# python
databaselist2 = databaselistunsorted2
print(databaselist2)