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. QMYSQL on Windows 10
Forum Updated to NodeBB v4.3 + New Features

QMYSQL on Windows 10

Scheduled Pinned Locked Moved Solved Installation and Deployment
6 Posts 2 Posters 608 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.
  • N Offline
    N Offline
    nyquistjack
    wrote on last edited by
    #1

    Hello,

    I have spent hours trying to connect to a MySQL DB from QTCreator. I get "Driver not loaded"

    I have read dozens of instructions on how to get this to work, every single one different in some way and none of them work. It looks like I need compile the drivers myself but all of the instructions say I need the mysql.pro file. It is not in my installation folder where it belongs so I downloaded the source files, and it isn't in there either.

    I am completely at a loss at this point, I really hope someone can get me going as I am completely stuck right now.

    1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      @nyquistjack said in QMYSQL on Windows 10:

      Anything else I can try?

      As suggested in other forum posts here start your app with the env var QT_DEBUG_PLUGINS set and make sure that the mysql dlls are in your PATH.

      N Offline
      N Offline
      nyquistjack
      wrote on last edited by
      #6

      @Christian-Ehrlicher Thanks. I ended following this hero's guide and finally got it working.

      https://github.com/thecodemonkey86/qt_mysql_driver

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

        @nyquistjack said in QMYSQL on Windows 10:

        k. It looks like I need compile the drivers myself but all of the instructions say I need the mysql.pro file.

        You should read the instructions for Qt6 when you use Qt6. There are tons of questions regarding this here in the forum so the search function will for sure help too.

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

        N 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          @nyquistjack said in QMYSQL on Windows 10:

          k. It looks like I need compile the drivers myself but all of the instructions say I need the mysql.pro file.

          You should read the instructions for Qt6 when you use Qt6. There are tons of questions regarding this here in the forum so the search function will for sure help too.

          N Offline
          N Offline
          nyquistjack
          wrote on last edited by
          #3

          @Christian-Ehrlicher Thanks, I have been very overwhelmed with this whole process and hadn't found the correct instructions so thanks for getting me to the right place.

          Regretfully I am hitting issues right off the bat. qt-cmake isn't in my path and it doesn't say where to find it, so I ran this one: C:\Qt\6.2.3\wasm_32\bin\qt-cmake.bat

          I immediately get his error among others:
          CMake Warning at C:/Qt/6.2.3/wasm_32/lib/cmake/Qt6/qt.toolchain.cmake:53 (message):
          The toolchain file to be chainloaded
          'C:/Utils/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake'
          does not exist.

          Here is my full command:
          C:\Code\build-sqldrivers>C:\Qt\6.2.3\wasm_32\bin\qt-cmake -G Ninja c:\qt\6.2.3\Src\qtbase\src\plugins\sqldrivers -DCMAKE_INSTALL_PREFIX=C:\Qt\6.2.3\mingw_64 -DMySQL_INCLUDE_DIR="C:\Program Files\MySQL\MySQL Server 8.0\include" -DMySQL_LIBRARY="C:\Program Files\MySQL\MySQL Server 8.0\include\libmysql.lib"

          And here is the full set of errors:
          CMake Warning at C:/Qt/6.2.3/wasm_32/lib/cmake/Qt6/qt.toolchain.cmake:53 (message):
          The toolchain file to be chainloaded
          'C:/Utils/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake'
          does not exist.
          Call Stack (most recent call first):
          C:/Qt/Tools/CMake_64/share/cmake-3.21/Modules/CMakeDetermineSystem.cmake:124 (include)
          CMakeLists.txt:7 (project)

          CMake Error at C:/Qt/6.2.3/wasm_32/lib/cmake/Qt6/QtPublicWasmToolchainHelpers.cmake:66 (message):
          Cannot find the toolchain file Emscripten.cmake. Please specify the
          toolchain file with -DQT_CHAINLOAD_TOOLCHAIN_FILE=<file> or provide a path
          to a valid emscripten installation via the EMSDK environment variable.
          Call Stack (most recent call first):
          C:/Qt/6.2.3/wasm_32/lib/cmake/Qt6/qt.toolchain.cmake:64 (__qt_internal_show_error_no_emscripten_toolchain_file_found_when_using_qt)
          C:/Qt/Tools/CMake_64/share/cmake-3.21/Modules/CMakeDetermineSystem.cmake:124 (include)
          CMakeLists.txt:7 (project)

          CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
          CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
          CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
          CMake Error: CMAKE_ASM_COMPILER not set, after EnableLanguage
          -- Configuring incomplete, errors occurred!

          Thank you for the help

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nyquistjack
            wrote on last edited by
            #4

            After fighting for the last 2 hours I finally made it through the entire build process without errors. I ran the cmake --install . and all went well.

            However, I am still receiving "Driver Not Loaded" when trying to use QMYSQL.

            Anything else I can try?

            Thanks

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

              @nyquistjack said in QMYSQL on Windows 10:

              Anything else I can try?

              As suggested in other forum posts here start your app with the env var QT_DEBUG_PLUGINS set and make sure that the mysql dlls are in your PATH.

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

              N 1 Reply Last reply
              1
              • Christian EhrlicherC Christian Ehrlicher

                @nyquistjack said in QMYSQL on Windows 10:

                Anything else I can try?

                As suggested in other forum posts here start your app with the env var QT_DEBUG_PLUGINS set and make sure that the mysql dlls are in your PATH.

                N Offline
                N Offline
                nyquistjack
                wrote on last edited by
                #6

                @Christian-Ehrlicher Thanks. I ended following this hero's guide and finally got it working.

                https://github.com/thecodemonkey86/qt_mysql_driver

                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