[solved]Qt 5.2 with MySQL- driver not loaded
-
Hello there,
I've downloaded and installed Qt 5.2 32 bit for android, my machine is windows 8 64bit, I also have visual studio 2012 installed, MySQL 5.6.16 32bit is installed.I'm trying to connect to a MySQL database, but I always get this error
QSqlDatabse: QMYSQL driver not loaded
QSqlDatabse: available drivers: QSQLIT QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7Here is my code
@
#include <QCoreApplication>
#include <QtSql>
#include <QtDebug>int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
return a.exec();
}
@I've known that in Qt 5.2 there is no need to build the driver, anyway I'v tried and built it but with no difference, I don't know if the built process went well or no.
Any suggestions please because I spent the last two days searching the net for a solution.
Thanks. -
Hi,
Do you have the path to your MySQL dlls in your PATH environment variable ? Also check that it's the case in the run panel in Qt Creator
-
Qt Creator -> Projects
Look at your kit, there's a build - run switch, check run and verify that the PATH in "Run environment" also contains the path to the dlls. You don't need to the the include path in PATH. -
Not in the sources no, only in the binary tree
-
I found the file qsqlmysql.dll in this path C:\Qt\Qt5.2.0\5.2.0\mingw48_32\plugins\sqldrivers and I run dependacy walker on it and here is a photo of what I got
!http://imageshack.com/a/img197/4814/ek87.JPG(There should be a photo here )!any tips?
-
I had similar problems with the postgresql driver when installing on a second Win7 machine. After making sure, that the database drivers were in the path ...mingw..plugins\sqldrivers and ...postgresql\lib and bin I still saw the simillar message (missing driver although in list) and I had to completely build new - now it works!
Perhaps you may delete the build-directories and build debug or release new. -
If I see thing correctly, you have a 64bit MySQL installed and the MinGW Qt package is 32bit
-
Hi Baso, I mean: delete the build directory of your application (ie ...myapp\Debug or ...myapp\Release). The location of your plugins is correct - for testing you may also copy the directory sqldrivers from C:\Qt\Qt5.2.0\5.2.0\mingw48_32\plugins\ to the application build directory ...myapp\Debug\sqldrivers.
-
<SOLVED>
@SGaist You are right (How embarrassing :) ) the tick was that I downloaded the offline MySQL installer for windows(x86-32bit) the installer is 32bit, but the server combined with it was (5.6 64bit) looks like there is no 5.6 server 32bit so I installed the 5.5 32bit server instead and it worked.Thank you all for your help.
-
How do you deal with numbers? Not everyone is good at math. Many of us were vexed by the complexity of those essential abstractions since school days. And still, as adults we need to build certain math skills to be able to make good financial decisions. We need to know the difference between simple and compound interest, and how to calculate each. And for those seeking to invest, the same can be said of dividends. Below are some basic steps to navigate through the labyrinth of figures. We humbly offer this information in a desire to help the mathematically impaired. How many times have you expected more details on how to apply for a payday loan and resorted to an internet search on quick cash advance?" Your search is over, all of the info you'll need is at "www.MatchFinancial.com.":http://www.matchfinancial.com/
-
You're welcome !
Now that you have it up and running, please update the thread title prepending [solved] so other forum users may know a solution has been found :)