MySQL database

  • QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
    My working MySQL database has started giving me the above error. I do not understand how the database is not loading the driver as it is plainly in sight.
    Anyone have any thoughts on how to correct this? Thanks in advance.

  • What OS are you on?

    This is a question that has been solved numerous times for different OSs"QMYSQL+driver+not+loaded"

  • Moderators


    Do you have MySQL installed and linked with the mysql lib?
    Under windows in most cases the dll for mySQL is not accesible by the application.

  • OS is windows;
    Here is the connection I am using.
    mydb = QSqlDatabase::addDatabase("QMYSQL");
    mydb.setPassword("xxxxxxxxxxx"); set with the real password of course

  • @koahnig
    The connection has been working for a couple of months already. Just now not connecting.

  • Moderators


    Probably you need to check if the dll is still where you/the application expect(s) it. Typically a change of folders for the application is creating such problems. All that depends on your setup.

    Did you check out the link provided by @VRonin ?

  • The solution for the QMYSQL not being loaded was the environment path variable needed to point to the lib folder.
    In my case it is C:/MySqlDB/lib

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.