MYSQL - Python Connector - No Response
Hello,
Situation
I am trying to troubleshoot my issue between Python and MYSQL. I have found myself in a situation where I am temporarily forced to develop on a Windows 11 machine. I am not sure if that is why I am experiencing problems as I have never had an issue on the *NIX machine. I am using MYSQL 8.0.40 and Python 3.13 64bit natively with MYSQL-Connector-Python installed via PIP.
Problem
When I try to connect and create, edit, view databases or tables I get no errors but I get no action either. Basically, I have confirmed that I can connect to MYSQL from Python but it appears no SQL statements execute.
Actions
I installed MYSQL from the MS Installer and Python without issue. I installed the connector using pip install mysql-connector-python without problem.
I am using the test example to connect to an existing DB using this:
------
import mysql.connector
cnx = mysql.connector.connect(user='user', password='pass',
host='localhost',
database='testdb')
cnx.close()
-----------
When I run the script, there are no errors so I assume it works. I experimented with changing the host using various IPs and got timeout errors back so I assume it is connecting.
I then tried to create a new DB using the following:
import mysql.connector
----------
mydb = mysql.connector.connect(
host="localhost",
user="yourusername",
password="yourpassword"
)
mycursor = mydb.cursor()
mycursor.execute("CREATE DATABASE mydatabase")
--------
There are no errors but no DB gets created. I've tried this with an existing DB and created a table with no success. I have checked permissions, and I have used MYSQL root user and an admin user with full rights.
Troubleshooting
How can I see what is happening? For example is there a log that might explain what is happening here. Is this a common problem around permissions on Win OS? If anyone can suggest what might be happening it will be appreciated.
Thank you in advance.
Subject
Written By
Posted
MYSQL - Python Connector - No Response
November 26, 2024 02:01PM
November 27, 2024 08:33AM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.