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 and not available
Forum Updated to NodeBB v4.3 + New Features

QSqlDatabase: QMYSQL driver not loaded and not available

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 406 Views 1 Watching
  • 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.
  • M Offline
    M Offline
    mturner
    wrote on last edited by
    #1

    Hello to all, I have the following error :

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

    The problem is that I can find nowhere on the internet how to solve this because there isn't QMYSQL in the available drivers already. I've downloaded MySql using brew, never had a pb but the dylib file isn't even in the plugin folder of Qt.

    Could someone help me? Spent so much time on this already.

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

      Hi and welcome to devnet,

      Depending on the version of Qt you have the plugin is not provided pre-built anymore because of a change in the license of MySQL, so you have to build it yourself.

      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
      • B Offline
        B Offline
        Bonnie
        wrote on last edited by Bonnie
        #3

        Hi, for recent Qt versions, the mysql plugin is no longer provided due to license problem of libmysql.
        You will need to build your own. Please refer to the doc:
        https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-unix-and-macos
        Or you can use older versions of Qt.

        1 Reply Last reply
        1
        • M Offline
          M Offline
          mturner
          wrote on last edited by mturner
          #4

          Hello, thank you for the quick response!!
          So I ran the following code :

          qmake -- MYSQL_PREFIX=/usr/local/Cellar/mysql/8.0.19_1/include
          

          And I get the "documentation" of how to use qmake so I'm guessing I'm doing something wrong...

          B 1 Reply Last reply
          0
          • M mturner

            Hello, thank you for the quick response!!
            So I ran the following code :

            qmake -- MYSQL_PREFIX=/usr/local/Cellar/mysql/8.0.19_1/include
            

            And I get the "documentation" of how to use qmake so I'm guessing I'm doing something wrong...

            B Offline
            B Offline
            Bonnie
            wrote on last edited by Bonnie
            #5

            @mturner First you need to cd to [QtDir]/Src/qtbase/src/plugins/sqldrivers which has .pro file and source code files in it.
            It is not the sqldrivers folder with other dylib files.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mturner
              wrote on last edited by mturner
              #6

              Thank you a lot !!! I was in the wrong plugin/sqldrivers directory. Thank you to all of you!

              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