MySQL driver not loaded in other computers.
-
wrote on 13 Oct 2021, 10:38 last edited by mengsen
Thanks all~
After many attempts, I found that the required files were
C:\Program Files\MySQL\MySQL Shell 8.0\bin\ -> libcrypto-1_1-x64.dll,libssl-1_1-x64.dll
C:\Program Files\MySQL\MySQL Server 8.0\lib\ -> libmysql.dll
into xxx.exe path
IN QT 5.15
I made a Qt application with mysql successfully.
And then I want test it in other computers.
I zip debug folder with required dlls and send it to my friends.
Application succesfully starts and working.
But, when accessing MySQL it says driver not loaded!
Did I miss something???I try to
The SQL database drivers are implemented as Qt plugins. All Qt plugins are in the "plugins" folder of your Qt installation. In that folder there is a subfolder called sqldrivers and this folder contains a file looking like "mysql.dll" which is the driver plugin for MySQL. To solve your issue, you must: 1/ Create a "plugins" folder in your ZIP so that it will be next to your executable 2/ Create a "sqldrivers" folder in that "plugins" folder and copy the "libmysql.dll" MySQL driver in that folder 3/ In your main function, call @QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath())@
Create a “sqldrivers” folder in the application's directory, then copy the xxxx.dll plugin to it is enough. No "plugins" directory is needed. No "addLibraryPath(...)" is needed
I used the deployment tool windeployqt like windeployqt.exe one_path I copy libmysql.dll to binpath and can use it in my env I zip this folder and send to my friends, MySQL it says driver not loaded
All Can't Solved
-
Thanks all~
After many attempts, I found that the required files were
C:\Program Files\MySQL\MySQL Shell 8.0\bin\ -> libcrypto-1_1-x64.dll,libssl-1_1-x64.dll
C:\Program Files\MySQL\MySQL Server 8.0\lib\ -> libmysql.dll
into xxx.exe path
IN QT 5.15
I made a Qt application with mysql successfully.
And then I want test it in other computers.
I zip debug folder with required dlls and send it to my friends.
Application succesfully starts and working.
But, when accessing MySQL it says driver not loaded!
Did I miss something???I try to
The SQL database drivers are implemented as Qt plugins. All Qt plugins are in the "plugins" folder of your Qt installation. In that folder there is a subfolder called sqldrivers and this folder contains a file looking like "mysql.dll" which is the driver plugin for MySQL. To solve your issue, you must: 1/ Create a "plugins" folder in your ZIP so that it will be next to your executable 2/ Create a "sqldrivers" folder in that "plugins" folder and copy the "libmysql.dll" MySQL driver in that folder 3/ In your main function, call @QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath())@
Create a “sqldrivers” folder in the application's directory, then copy the xxxx.dll plugin to it is enough. No "plugins" directory is needed. No "addLibraryPath(...)" is needed
I used the deployment tool windeployqt like windeployqt.exe one_path I copy libmysql.dll to binpath and can use it in my env I zip this folder and send to my friends, MySQL it says driver not loaded
All Can't Solved
@mengsen said in MySQL driver not loaded in other computers.:
I zip debug folder with required dlls and send it to my friends.
This is not enough.
Please take a look at https://doc.qt.io/qt-5/windows-deployment.html
There is explained what needs to be deployed and how. You can also use the Windows deployment tool (same link). -
@mengsen said in MySQL driver not loaded in other computers.:
I zip debug folder with required dlls and send it to my friends.
This is not enough.
Please take a look at https://doc.qt.io/qt-5/windows-deployment.html
There is explained what needs to be deployed and how. You can also use the Windows deployment tool (same link).wrote on 13 Oct 2021, 11:24 last edited by mengsen@jsulm said in MySQL driver not loaded in other computers.:
There is explained what needs to be deployed and how. You can also use the Windows deployment tool (same link).
- I used the deployment tool windeployqt like
windeployqt.exe one_path
- I copy
libmysql.dll
to binpath and can use it in my env - I zip this folder and send to my friends, MySQL it says driver not loaded
- I used the deployment tool windeployqt like
-
@jsulm said in MySQL driver not loaded in other computers.:
There is explained what needs to be deployed and how. You can also use the Windows deployment tool (same link).
- I used the deployment tool windeployqt like
windeployqt.exe one_path
- I copy
libmysql.dll
to binpath and can use it in my env - I zip this folder and send to my friends, MySQL it says driver not loaded
wrote on 13 Oct 2021, 11:33 last edited by JonB@mengsen
Then start by asking your users to set environment variableQT_DEBUG_PLUGINS
to value1
in a terminal. Then run your application from there. They will get a whole load of diagnostic output. Look at right near the end. Somewhere there should be information as to what the issue is for being unable to load the driver. You could compare this against the output you get when it's successful. - I used the deployment tool windeployqt like
-
@jsulm said in MySQL driver not loaded in other computers.:
There is explained what needs to be deployed and how. You can also use the Windows deployment tool (same link).
- I used the deployment tool windeployqt like
windeployqt.exe one_path
- I copy
libmysql.dll
to binpath and can use it in my env - I zip this folder and send to my friends, MySQL it says driver not loaded
@mengsen said in MySQL driver not loaded in other computers.:
I copy libmysql.dll to binpath and can use it in my env
Plug-ins should be inside plugins sub-folder as described in the link I posted before.
In your environment it is working because the plug-ins are also available from your Qt installation. You can test locally on a vanilla Windows before sending to your customers (you could use a virtual machine with Windows). - I used the deployment tool windeployqt like
-
@mengsen
Then start by asking your users to set environment variableQT_DEBUG_PLUGINS
to value1
in a terminal. Then run your application from there. They will get a whole load of diagnostic output. Look at right near the end. Somewhere there should be information as to what the issue is for being unable to load the driver. You could compare this against the output you get when it's successful. -
wrote on 13 Oct 2021, 14:12 last edited by JonB
@mengsen
Of course!- Open a Command Prompt.
- Type:
set QT_DEBUG_PLUGINS=1
, then <Enter> key. - Run the executable (presumably by typing its full path).
- Look at what you get back in the Command Prompt.
Try it first on your system where it works. Then try it where it does not. You are usually interested in the end of the diagnostic output, where it indicates why it could not load MySQL driver.
EDIT Ohhh, I have a bad feeling that under Windows someone said the diagnostic output does not go to the terminal where you run from, like it does under Linux, instead it goes somewhere for Windows logging instead :(
Yep, see https://www.qtcentre.org/threads/34927-QT_DEBUG__PLUGINS-Windows-7-where-does-it-log-information
One post said "Then I use sysinternals debugview free utility to monitor the output at run-time."
See post on this forum https://forum.qt.io/topic/41943/platform-plugin-windows/8Hi, just an update on why QT_DEBUG_PLUGINS=1 doesn't work as expected when you launch a Qt app from the command line (as it does on Linux and Macs): I found that for Windows MSVC and MinGW compilers, Qt routes the texts to OutputDebugString(), that's why the CMD window shows no output.
Instead, to see the output, download "Sysinternal's DbgView":http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx
1/7