QSqlDatabase: QMYSQL driver not loaded
-
Never mind my friend anyway thank you very much!
Yes I have tried it and got this:E: Unable to locate the package libmysqlclient16
or this :
E: Unable to locate the package libmysqlclient16-dev
@SGaist
xaxaax my friend like your answer.
"You can't cheat like that on Linux ;)"As for the guide (documentation) , basically confuses me a little and I do not know if I can follow him because for example he says to run this command :
cd $QTDIR/qtbase/src/plugins/sqldrivers/mysql
But me the file structure is :
:~$ ls Qt 5.4 components.xml Docs Examples Extras InstallationLog.txt Licenses MaintenanceTool MaintenanceTool.dat MaintenanceTool.ini network.xml Tools
:~/Qt/5.4$ ls android_armv7 gcc
:~/Qt/5.4/gcc$ ls bin icudtl.dat imports include lib libexec mkspecs phrasebooks plugins qml qtwebengine_resources.pak translations
:~/Qt/5.4/gcc/plugins$ ls -l audio bearer designer generic geoservices iconengines imageformats mediaservice platforminputcontexts platforms platformthemes playlistformats position printsupport qml1tooling qmltooling qtwebengine sensorgestures sensors sqldrivers <-----------
:~/Qt/5.4/gcc/plugins$ tree sqldrivers/ sqldrivers/ ├── libqsqlite.so ├── libqsqlmysql.so └── libqsqlpsql.so
the path that says, to me (as you see) does not exist. :/
Extra searches:find ~/Qt -name "sqldrivers" /home/myuser/Qt/Tools/QtCreator/bin/plugins/sqldrivers /home/myuser/Qt/5.4/gcc/plugins/sqldrivers
$find ~/Qt -name "qtbase" -nothing-
$ find ~/Qt -name "mysql" -nothing-
In my system the folders with name "mysql" are only those :
sudo find / -name "mysql" /var/lib/mysql /var/lib/mysql/mysql /var/log/mysql /etc/apparmor.d/abstractions/mysql /etc/init.d/mysql /etc/mysql /usr/bin/mysql /usr/lib/perl5/auto/DBD/mysql /usr/lib/perl5/DBD/mysql /usr/lib/mysql /usr/share/maven-repo/mysql /usr/share/mysql /usr/share/bash-completion/completions/mysql /usr/include/mysql /usr/include/mysql/mysql
and folder named "qtbase" does not exist.
For this reason the documentation does not help. -
That's because you don't have the Qt sources installed. Use
maintenancetool
to download them. -
@SGaist
Unbelievable though it was in front of me I had no idea about the "maintenancetool". I am inexperienced with using Qt not know so much about this, but I hope now to learn.I ran as you said the "MaintenanceTool" located in the "Qt" folder and i installed the "sources".
Then I have what I needed! :DThe guide now is satisfactory and effective. ;)
Simply the guide says this path:
cd $QTDIR/qtbase/src/plugins/sqldrivers/mysql
to me is this:
/home/myuser/Qt/5.4/Src/qtbase/src/plugins/sqldrivers/mysql
Then because I have and version "Qt4" this command:
qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
i run in this way:
/home/myuser/Qt/5.4/gcc/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
All now work perfectly! I'm very happy about that! I Struggled a lot with this issue and does not need nor expecting.
Thank you very very much my friends! I am indebted to your with your efficient and fast help!THANK YOU!
-
Hi,
As silly as it may sound: that's the sources of the Qt library.
-
@Gualtix Hi and welcome to devnet, you are not following the current documented procedure.