Solved Error in qt 5.12.7 QSqlDatabase: QMYSQL driver not loaded
-
@KroMignon
And your answer could do with being stickied somewhere, as this gets asked a lot and your code should always be the first advice.... -
@KroMignon said in Error in qt 5.12.7 QSqlDatabase: QMYSQL driver not loaded:
According to ldd output, loading the plugin should not be a problem, all dependencies are met...
Really? I would say it's messed up:
libQtSql.so.4 => /lib/x86_64-linux-gnu/libQtSql.so.4 (0x00007f2117a32000)
libQtCore.so.4 => /lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007f2117728000) -
@Christian-Ehrlicher said in Error in qt 5.12.7 QSqlDatabase: QMYSQL driver not loaded:
Really? I would say it's messed up:
Damn your are right!
@sertux you have a problem with your plugin:
...
libQtSql.so.5 => /home/smv/Qt/5.12.7/gcc_64/libQtSql.so.5 (...)
libQtCore.so.5 => home/smv/Qt/5.12.7/gcc_64/libQtCore.so.5 (...)
...
I think there is something going wrong during installation or your LD_LIBRARY_PATH setting may be wrong?!?Thanks @Christian-Ehrlicher !
-
@KroMignon
It seems there is a problem while loading the plugin..."Failed to extract plugin meta data from '/home/smv/Qt/5.12.7/gcc_64/plugins/sqldrivers/libqsqlmysql.so'"
not a plugin?? What am I supposed to do with this ?? I have libqsqlmysql.so in the right folder.
@KroMignon said in Error in qt 5.12.7 QSqlDatabase: QMYSQL driver not loaded:
@Christian-Ehrlicher said in Error in qt 5.12.7 QSqlDatabase: QMYSQL driver not loaded:
Really? I would say it's messed up:
Damn your are right!
@sertux you have a problem with your plugin:
...
libQtSql.so.5 => /home/smv/Qt/5.12.7/gcc_64/libQtSql.so.5 (...)
libQtCore.so.5 => home/smv/Qt/5.12.7/gcc_64/libQtCore.so.5 (...)
...
I think there is something going wrong during installation or your LD_LIBRARY_PATH setting may be wrong?!?Thanks @Christian-Ehrlicher !
Sorry but, what should I do with this information ?
I have no LD_LIBRARY_PATH but compiler is looking into the right folder.
And I don't have any libQtSql.so.5 or libQtCore.so.5 in /home/smv/Qt/5.12.7/gcc_64/Thank you for helping me !
-
@sertux We are trying to help you, as far as I understand you:
- you want to use mySQL plugin with Qt 5.12.7.
- you have installed Qt 5.12.7 into /home/smv/Qt/5.12.7/gcc_64/
- loading the plugin do not work.
What I try to find out is why, just as side note, I don't use Linux myself, I develop with Windows and Android, so it could happen that I made some mistakes.
One of this is, that I missed to add "lib" in my previous post
...
libQtSql.so.5 => /home/smv/Qt/5.12.7/gcc_64/lib/libQtSql.so.5 (...)
libQtCore.so.5 => home/smv/Qt/5.12.7/gcc_64/lib/libQtCore.so.5 (...)
...Sorry about that.
On your previous message with ldd output, it look likes your mysqlplugin want to used Qt 4.xx libraries not Qt 5. Are you sure you have done Qt 5.12.7 installation in the right way?
-
@KroMignon said in Error in qt 5.12.7 QSqlDatabase: QMYSQL driver not loaded:
@sertux We are trying to help you, as far as I understand you:
- you want to use mySQL plugin with Qt 5.12.7.
- you have installed Qt 5.12.7 into /home/smv/Qt/5.12.7/gcc_64/
- loading the plugin do not work.
What I try to find out is why, just as side note, I don't use Linux myself, I develop with Windows and Android, so it could happen that I made some mistakes.
One of this is, that I missed to add "lib" in my previous post
...
libQtSql.so.5 => /home/smv/Qt/5.12.7/gcc_64/lib/libQtSql.so.5 (...)
libQtCore.so.5 => home/smv/Qt/5.12.7/gcc_64/lib/libQtCore.so.5 (...)
...Sorry about that.
On your previous message with ldd output, it look likes your mysqlplugin want to used Qt 4.xx libraries not Qt 5. Are you sure you have done Qt 5.12.7 installation in the right way?
I've used Qt Maintenance Tool to install Qt5.12.7. And I've used apt-get to install mysql lib... Maybe this is not the right way to do it... ?
sorry for my english, that's not perfect :/ -
I'm pretty sure in Qt5.12.7 there will be not mysql plugin available with the maintainance tool due to legal reasons (in the opensource version at least). Make sure the plugin really matches your Qt installation.
-
@Christian-Ehrlicher I didn't use the maintenance tool to install mysql libs but I used Debian's package management tool (apt-get).
-
So when you don't use the Qt provided by your os then I'm pretty sure you have to compile it by yourself: https://doc.qt.io/qt-5/sql-driver.html
-
@Christian-Ehrlicher This is true... (I swear, I didn't see your post before to find this solution.
So I just add those commands I used for those it coul'd help :cd ~/Qt/5.12.7/Src sh configure -sql-mysql
Choose youre version
Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.Which edition of Qt do you want to use? o
Accept license
Type 'L' to view the GNU Lesser General Public License version 3 (LGPLv3).
Type 'G' to view the GNU General Public License version 2 (GPLv2).
Type 'y' to accept this license offer.
Type 'n' to decline this license offer.Do you accept the terms of either license? y
And be sure to see this line
MySql .................................. yes
cd qtbase/src/plugins/sqldrivers/mysql/ /home/smv/Qt/5.12.7/gcc_64/bin/qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro make install
That's it :)
Thanks everyone for your great help.