Important: Please read the Qt Code of Conduct -

QT version 4.8 to 5.7 QMySQl

  • Hi there,
    I made a new installation of my raspberry pi 3 and I reinstalled Qt 5.7.

    So my program was in 4.8 and whe, I try to compile with all my libraries, I've got a problem on the mysql driver. I did'nt find anywhere whitch package should I install. Somebody have a solution for that ?
    Thanks by advance.

    my problem :

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE

  • Lifetime Qt Champion


    You need the MySQL client libraries.

    ldd will give you the dependencies needed by the plugin.

  • Thanks for your answer,
    By using ldd I'm getting a long list of .so files , so I assume Qt doesn't find them or there are not installed, anyway I think there's a lot files needed to just find and copy them into the mysql forlder in Qt . What do you think?

    pi@dex:/usr/local/Qt-5.7.1/plugins/sqldrivers $ ldd (0x7eeed000)
    	/usr/lib/arm-linux-gnueabihf/ (0x76e62000) => /usr/local/Qt-5.7.1/plugins/sqldrivers/./../../lib/ (0x76e25000) => /usr/local/Qt-5.7.1/plugins/sqldrivers/./../../lib/ (0x76919000) => /lib/arm-linux-gnueabihf/ (0x768d9000) => /usr/lib/arm-linux-gnueabihf/ (0x767fd000) => /lib/arm-linux-gnueabihf/ (0x76782000) => /lib/arm-linux-gnueabihf/ (0x76754000) => /lib/arm-linux-gnueabihf/ (0x76613000) => /lib/arm-linux-gnueabihf/ (0x765ec000) => /lib/arm-linux-gnueabihf/ (0x765d9000) => /lib/arm-linux-gnueabihf/ (0x765c2000)
    	/lib/ (0x54b14000)

  • Lifetime Qt Champion

    No, this one looks good, since all dependencies can be found.

    Qt doesn't look for any libraries, it looks for its own plugins. It's the job of the loader to find the libraries on a system.

    From what you wrote it's the MySQL plugin that you want to analyse not the SQLite.

  • Yes I have a MySql Database and I need to make Qt works with it (was running in previous version)

  • Lifetime Qt Champion

    Then run ldd on that plugin please.

  • The problem is that I don't know where it is , I don't have any MySql Librairies in Qt...

  • Lifetime Qt Champion

    So you mean the plugin wasn't built ?

  • I installed Qt via the tar.gz file so I build it by myself , is there any chances that the library is not build in the same time ?
    In /usr/local/Qt-5.7.1/plugins/sqldrivers I just have file so I assume that's where I need to have my MySQL files since I only have the sql detected by Qt.

  • Lifetime Qt Champion

    Do you have the MySQL dev package for ARM on your system ?

    If not, then that's one of the reason why it wasn't built. If you have it, then it might not have been found.

    In any case, you don't need to re-build all of Qt. Just build the plugin by hand like shown in the documentation.

  • I just installed Mysql to run it on my rasp , I tried to use some command to get the mysql packages but don't know if that works , do you have the command to get the dev package or the doc link please?

    EDIT : sudo apt-get install mysql-client libmysqlclient-dev I tried this command line but it looks that I already have the packages.

  • Lifetime Qt Champion

    @Amaury Then try to build the plug-in and see what happens.

  • @jsulm How are you doing that ?
    EDIT :

    Problem seems to be solved with the mysql connector package that I didn't downloaded
    For those who have the same problem try the command :

    sudo apt-get install libmysqlcppconn-dev
    That worked for me , thank you guys .

  • Lifetime Qt Champion

    @Amaury As @SGaist said: "Just build the plugin by hand like shown in the documentation"

Log in to reply