Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MySQL driver on Windows 10
Qt 6.12 LTS is out! See what's new in the release blog

MySQL driver on Windows 10

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.5k Views 2 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.
  • I Offline
    I Offline
    Infinity
    wrote on last edited by
    #1

    First of all I have to mention that I'm not very familiar with Windows, but I have to compile my application on Windows 10. For this I installed MySQL Server 8.0 and Qt 5.13.1. Now I would like to build the mysql driver for Qt.

    Here is my mysql.pro:

    TARGET = qsqlmysql
    
    INCLUDEPATH += "C:/MySQL/MySQL Server 8.0/include"
    LIBS += -L"C:/MySQL/MySQL Server 8.0/lib"
    LIBS += -llibmysql
    
    HEADERS += $$PWD/qsql_mysql_p.h
    SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
    
    QMAKE_USE += mysql
    
    OTHER_FILES += mysql.json
    
    PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
    include(../qsqldriverbase.pri)
    

    When I run qmake I get the following error:

    Project ERROR: Library 'mysql' is not defined.

    Here is the listing of the MySQL direcoty:

    07.09.2019  08:17    <DIR>          .
    07.09.2019  08:17    <DIR>          ..
    26.06.2019  21:19         7’101’952 http_auth_backend.dll
    26.06.2019  21:19         7’071’744 http_auth_realm.dll
    26.06.2019  21:19         7’353’344 http_server.dll
    26.06.2019  21:19            19’968 keepalive.dll
    26.06.2019  21:18         6’479’872 libmysql.dll
    26.06.2019  21:18            29’188 libmysql.lib
    07.09.2019  08:17    <DIR>          mecab
    26.06.2019  21:20         7’892’992 metadata_cache.dll
    26.06.2019  21:18        65’764’822 mysqlclient.lib
    26.06.2019  21:18            44’750 mysqlrouter_http.lib
    26.06.2019  21:19        22’951’984 mysqlrouter_lib.lib
    26.06.2019  21:19            90’624 mysql_protocol.dll
    07.09.2019  08:17    <DIR>          plugin
    26.06.2019  21:20         7’111’680 rest_api.dll
    26.06.2019  21:20         7’121’920 rest_metadata_cache.dll
    26.06.2019  21:20         7’096’320 rest_router.dll
    26.06.2019  21:20         7’140’864 rest_routing.dll
    26.06.2019  21:20         7’461’376 routing.dll
                  16 Datei(en),    160’733’400 Bytes
                   4 Verzeichnis(se), 120’553’926’656 Bytes frei
    
    c:\MySQL\MySQL Server 8.0\lib>
    

    What am I doing wrong here?

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

      Hi,

      Looks like you are not following the Qt SQL drivers documentation, are you ?

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

        I tried it, butthe directory C:/MYSQL/MySQL Server <version>/lib/opt does not exist on my Windows installation and I also got the message that %QTDIR%\qtbase\src\plugins\sqldrivers does not exist.

        I have Qt installed here:
        C:\Qt\5.13.1\Src\qtbase\src\plugins\sqldrivers/

        and MySQL here:
        C:\MySQL\MySQL Server 8.0\

        The libmysql.dll is in this directory:
        C:\MySQL\MySQL Server 8.0\lib\

        but there is no:
        C:\MySQL\MySQL Server 8.0\lib\opt

        How would the qmake command line look like with this setup?

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

          You have to update the example given in the documentation to match what you have 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
          • Jungkang65J Offline
            Jungkang65J Offline
            Jungkang65
            Banned
            wrote on last edited by Jungkang65
            #5
            This post is deleted!
            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
            • Unsolved