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. I can not connect to mysql database
Forum Updated to NodeBB v4.3 + New Features

I can not connect to mysql database

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 1.2k Views 4 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.
  • OsamaO Offline
    OsamaO Offline
    Osama
    wrote on last edited by
    #1

    This is console result:
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

    ? the_T 2 Replies Last reply
    0
    • OsamaO Osama

      This is console result:
      QSqlDatabase: QMYSQL driver not loaded
      QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      @Osama Hi, and welcome to the Qt forum!
      I've found this on qtcentre:

      Had the same problem => Plugin QMYSQL & QMYSQL 3 were available but couldn't load them :
      "QSqlDatabase: QMYSQL driver not loaded / QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7"

      Works for me on Windows with Qt SDK 5.6.0 (32bit version with mingw 4.9.2 32bit included) :

      • Downloaded MySQL 32bit in zip archive (mine was v5.7.11)
      • Extracted it to C:/MySQL
      • Copied "C:\Qt\QMySQL\lib\libmysql.dll" and "C:\Qt\QMySQL\lib\libmysqld.dll" to Windows/System32 (to avoid the "cannot found -llibmysql" compilation error)
      • Compile with "How to Build the QMYSQL Plugin on Windows" on http://doc.qt.io/qt-5/sql-driver.html#qmysql (my command was "qmake "INCLUDEPATH+=C:\Qt\QMySQL\include" "LIBS+=C:\Qt\QMySQL\lib\libmysql.lib" sql.pro" and "mingw32-make")
      • After compilation succeeded, copy (the freshly compiled) Qt5Sql.dll & Qt5Sqld.dll from "C:\Qt\Qt5.6.0\5.6\Src\qtbase\lib" to your application build directory
      • Restart QtCreator, that should work
      1 Reply Last reply
      1
      • OsamaO Osama

        This is console result:
        QSqlDatabase: QMYSQL driver not loaded
        QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

        the_T Offline
        the_T Offline
        the_
        wrote on last edited by
        #3

        @Osama

        Can you please provide some more information?
        Which operating system are you using? Whats the Qt version? Maybe you also can provide the piece of code how you try to access the database?

        -- No support in PM --

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

          Hi,

          If I may, copying libraries to Windows/System32 even if easy is a really bad idea. You can wreak havoc on other software doing that.

          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
          1

          • Login

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