⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

QMYSQL driver not loaded

  • Hello, I would like to connect in a local database, i use MySql/phpMyAdmin with XXAMP in ubuntu, i configure the file my.cnf and add the line bind-adress =

    My source :


    Output :
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7


  • Lifetime Qt Champion


    Please take the time to search the forum, this question has been asked many times over the years and recently.

    You likely have more a recent version of the MySQL client libraries that the one used to build the plugin. You can check that by running ldd on the Qt MySQL plugin. If so then install the MySQL client libraries dev package and rebuild the plugin (only the plugin there's no need to build of all Qt).

  • For compiling a Plugin Library for your MySql Version, go to "QT_Path/Your_Version/Src/qtbase/src/plugins/sqldrivers/mysql/". In this directory execute qmake and then make.

  • Sorry for late reply, I had a problem with Qt.
    I compiled, but I have the same error when I connect

    alt text

  • Lifetime Qt Champion

    Do you have the MySQL .dlls folder in your PATH ?

    If not then they won't be found when you start your application thus the plugin can't be loaded.

    You can modify the PATH environment variable in the Run part of the Project panel in Qt Creator.

  • It works. I added libmysql.dll "C:\mysql\lib" in the project.
    thanks for the help !! :)

  • Lifetime Qt Champion

    You're welcome !

    Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

Log in to reply