QSqlDatabase: QMYSQL driver not loaded ubuntu, Qt5.14.0
-
@mvsri Thanks for the reply
sudo apt-get install libqt5sql5-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
libqt5sql5-mysql is already the newest version (5.12.2+dfsg-4ubuntu1.1).
The following packages were automatically installed and are no longer required:
libdumbnet1 php7.3-dev
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. -
@sujith-D said in QSqlDatabase: QMYSQL driver not loaded ubuntu, Qt5.14.0:
I can't figure out where I am missing.
There is nothing missing - all is fine as you can see:
/usr/lib/qt5/bin/qmake -install qinstall -exe ../plugins/sqldrivers/libqsqlmysql.so /usr/lib/x86_64-linux-gnu/qt5/plugins/sqldrivers/libqsqlmysql.so
The plugin is now correctly installed for your custom Qt5.14.0 installation
-
@Christian-Ehrlicher But unfortunately when I run my code it shows this error
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
open fail
"Driver not loaded" -
Ah sorry, you did something wrong.
You called the wrong qmake executable so it was installed into your system Qt installation. You have to remove config.cache, and run the correct qmake (from where you installed Qt 5.14.0 into) -
@Christian-Ehrlicher said in QSqlDatabase: QMYSQL driver not loaded ubuntu, Qt5.14.0:
qmake
Bro how to remove the config cache, and how to run correct qmake , if my qt installed path is /home/sujith/Qt5.14.0/5.14.0/Src/
-
How to remove: delete the file/folder using for example rm.
For qmake, use the full path to the executable you want to call.
-
The config.cache file is create by qmake in /Qt5.14.0/5.14.0/Src/qtbase/src/plugins/sqldrivers - you simply could have take a look there to find it.
-
Thanks found /home/sujith/Qt5.14.0/5.14.0/Src/qtbase/src/plugins/sqldrivers/config.cache
rm /home/sujith/Qt5.14.0/5.14.0/Src/qtbase/src/plugins/sqldrivers/config.cache ?
then again qmake -- MYSQL_PREFIX= fullpath ?
how to find fullpath ? -
@sujith-D said in QSqlDatabase: QMYSQL driver not loaded ubuntu, Qt5.14.0:
how to find fullpath ?
you should know where you installed your Qt5.14. installation into, so you can also find the correct qmake in there - we don't know where you installed your Qt5.14 binary files (your comment about /home/sujith/Qt5.14.0/5.14.0/Src is wrong - at least I don't think that you installed your binary files into the source dir)