Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Building MySQL driver with Qt 5.13.1
Forum Updated to NodeBB v4.3 + New Features

Building MySQL driver with Qt 5.13.1

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
6 Posts 2 Posters 546 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
    caxelc
    wrote on last edited by
    #1

    I'm working with Qt 5.13.1 and need to load the MySQL driver.
    So far I have tried copying the required DLLs (which were provided for me by someone) into C:\Qt\5.13.1\msvc2017_64\plugins\sqldrivers, however the following output is generated:

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

    Google suggested that I need to build the driver, so I tried following the instructions on https://doc.qt.io/qt-5/sql-driver.html#qmysql.

    However, running cd %QTDIR%\qtbase\src\plugins\sqldrivers returns:

    The system cannot find the path specified.
    
    

    I've downloaded the sources for Qt 5.13.1 so can't think why the path can't be found.

    Does anyone have any experience making MySQL work with Qt 5.13.1 (MSVC 2017 64-bit)?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      So did you open the Qt command prompt? If so the env variable QTDIR should be set.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • C Offline
        C Offline
        caxelc
        wrote on last edited by
        #3

        How can I check if it is?

        Christian EhrlicherC 1 Reply Last reply
        0
        • C caxelc

          How can I check if it is?

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @caxelc said in Building MySQL driver with Qt 5.13.1:

          How can I check if it is?

          You should know if you simply opened a cmd.exe or started the Qt command prompt.

          echo %QTDIR%

          (basic windows stuff - see e.g. here: https://docs.microsoft.com/de-de/windows-server/administration/windows-commands/set_1 )

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • C Offline
            C Offline
            caxelc
            wrote on last edited by
            #5

            So I'm running "set %QTDIR%" and getting "Environment variable %QTDIR% not defined".

            1 Reply Last reply
            0
            • C Offline
              C Offline
              caxelc
              wrote on last edited by
              #6

              Ok, so I've tried this:

              C:\Qt\5.13.1\msvc2017_64>cd C:\Qt\5.13.1\Src\qtbase\src\plugins\sqldrivers
              
              C:\Qt\5.13.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:\Program Files\MySQL\Connector C++ 8.0\include" MYSQL_LIBDIR="C:\Program Files\MySQL\Connector C++ 8.0\lib64"
              Project ERROR: Cannot run compiler 'cl'. Output:
              ===================
              ===================
              Maybe you forgot to setup the environment?
              
              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