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:
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:
- I try to connect using QSqlDatabase.addDatabase(‘QMYSQL’)
- Instatiate a QSqlTableModel that uses that db connection and sets a single table of that database.
- Display this single table in a QTableView.
Thanks in advance for your help