QMYSQL on Windows 10
-
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.
-
@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.
@Christian-Ehrlicher Thanks. I ended following this hero's guide and finally got it working.
-
@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.
-
@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.
@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
-
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
-
@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.
-
@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.
@Christian-Ehrlicher Thanks. I ended following this hero's guide and finally got it working.