Qt5 Mysql Driver Not Loaded Windows

  1. Qt5 Mysql Driver Not Loaded Windows

Has anyone been able to connect to Mysql within QT using Windows 7 + mingw? The MySql installer is. Gives the error 'QMYSQL Driver not loaded'. My PATH variables does refer. What I would do 1. Use to make sure that all the dlls that mysql driver requires are available.

Qt5 Mysql Driver Not Loaded Windows

Active2 years, 1 month ago

Under Ubuntu 17.04 I develop a Python 3 application using PyQt5 (which uses Qt5 5.8.0) and mysql (5.7.18). All has been well recently until today, I now get upon launching:

This is what happens if you have not previously done a:

but I have done that, and tried uninstalling it and reinstalling it with same result.

  • Kilauea; Mount Etna; Mount Yasur; Mount Nyiragongo and Nyamuragira; Piton de la Fournaise; Erta Ale.
  • Hello there, I've downloaded and installed Qt 5.2 32 bit for android, my machine is windows 8 64bit, I also have visual studio 2012 installed, MySQL 5.6.16 32bit is installed. I'm trying to connect to a MySQL database, but I always get this error QSqlDatabse: QMYSQL driver not loaded QSqlDatabse:.

Running locate libqsqlmysql shows me:

The first of these is dated Feb 9 2017, I believe it is Qt5 and not PyQt5, it ldds without error, and I do not think is relevant.

The second however is dated Jun 21 2017, so looks like the culprit. If I go: ldd /usr/local/lib/python3.5/dist-packages/PyQt5/Qt/plugins/sqldrivers/libqsqlmysql.so, in the output I note:

Am I right that is the problem? So it's a PyQt5 issue, not a Qt5 one? Can anyone suggest how to remedy? (I do not have an old state to revert to.)

JonBraveJonBrave

1 Answer

Well, this turned out to be a pip3/PyCharm issue:

Qt5 mysql driver not loaded windows
  • I has previously done apt-get install python3-pyqt5.
  • The apt-get install libqt5sql5-mysql had previously installed /usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/libqsqlmysql.so, and all was well.
  • Then PyCharm made me do apt-get install python3-pip (I was lucky I recalled this), and proceeded to do some kind of pip3 install pyqt5 behind the scenes.
  • This had created its own /usr/local/lib/python3.5/dist-packages/PyQt5/Qt/plugins/sqldrivers/libqsqlmysql.so, and as can be seen from the ldd output there had left the area in an incomplete/inconsistent state.
  • pip3 uninstall pyqt5 removed that, and reverted me to an error-free installation.

I had previously managed to avoid any pip3, successfully installing everything via apt-get. This experience has left me not trusting pip3 at all, if it can simply create an erroneous installation without any messages.

JonBraveJonBrave

Not the answer you're looking for? Browse other questions tagged mysqlqt5pyqt5 or ask your own question.

Posted :