Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSqlDatabase: QMYSQL driver not loaded
QtWS25 Last Chance

QSqlDatabase: QMYSQL driver not loaded

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 541 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CroCo
    wrote on last edited by
    #1

    This problem seems common but I couldn't find a proper solution. I'm developing a project that requires MySQL database. Every time I try to connect, I get this error:

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

    It tells me the driver is available but can't be loaded.

    I'm using Qt 5.9 in Windows 10. I'm using Qt 5_9_1_MinGW_32bit-Debug I've built the sqldrivers and they are listed in

    C:\Qt\5.9.1\mingw53_32\plugins\sqldrivers

    Also, I've installed MySQL community server. For .pro, I've included QT+=sql. I'm not sure what issues may cause this problem. Changing QMYSQL to QSQLITE made the connection but failed to retrieved data from the dababase. In the source code,

    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you have a MinGW build of MySQL on your system ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved