PyQt5 MYSQL driver not loaded windows

Heads up! You've already completed this tutorial.

eaperezdelgado6031 | 2020-08-19 14:40:11 UTC | #1

Hello I am having this issue when I am trying to connect to a local mysql database using QSqlDatabase.addDatabe method. I've found this issue in a lot of forums, but with no clear solutions especially as most of them as for C++ and I can't understand the Qt documentarion on mysql drivers, (there are no really good documentation for PyQt)

This is error I get when try to run my python script:

python
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

I am using Windows 10, MySql 8, Python 3.7, PyQt 5.9 and PyQt-tools 5.9 (I am using this version of PyQt because I am also using fbs, the fbs manual says it works better with that version of PyQt5)

This is a useful statement that I read in stackoverflow but it is for C++: """ Remember that qsqlmysql plugin is basically a qt interface that uses mysql-C connector methods. But unfortunately this connector does not distributed with Qt, so you should provide it by yourself. """

In summary I'd like to know which are missing files (.dll, .so, .lib)? where do I get them? and where do I copy them? in case for Python

Please if you need my script, but it is simple: 1) I try to connect using QSqlDatabase.addDatabase('QMYSQL') 2) Instatiate a QSqlTableModel that uses that db connection and sets a single table of that database. 3) Display this single table in a QTableView.

The complete guide to packaging Python GUI applications with PyInstaller.
[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]

Thanks in advance for your help


Create GUI Applications with Python & Qt5 by Martin Fitzpatrick — (PyQt5 Edition) The hands-on guide to making apps with Python — Over 10,000 copies sold!

More info Get the book

Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

PyQt5 MYSQL driver not loaded windows was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.