How to view a MySQL database using a PyQt6 interface?
Verfasst: Dienstag 27. Januar 2026, 11:10
Hello,
I would like to view a MySQL database using a PyQt6 interface.
How to view a MySQL database using a PyQt6 interface.
... db = QtSql.QSqlDatabase.addDatabase('QMYSQL')
db.setHostName('192.168.75.130')
db.setPort(3306)
db.setUserName('myusername')
db.setPassword('mypassword')
db.setDatabaseName('My_DB')
if not db.open():
Widgets.QMessageBox.critical(None, "Database error", db.lastError().text())
Unfortunately, I keep getting the following error message:
Driver not loaded
The solutions I found via Google don't work. The MySQL connector is installed. I would be very grateful for any tips.
I would like to view a MySQL database using a PyQt6 interface.
How to view a MySQL database using a PyQt6 interface.
... db = QtSql.QSqlDatabase.addDatabase('QMYSQL')
db.setHostName('192.168.75.130')
db.setPort(3306)
db.setUserName('myusername')
db.setPassword('mypassword')
db.setDatabaseName('My_DB')
if not db.open():
Widgets.QMessageBox.critical(None, "Database error", db.lastError().text())
Unfortunately, I keep getting the following error message:
Driver not loaded
The solutions I found via Google don't work. The MySQL connector is installed. I would be very grateful for any tips.