QSqlDatabase: QMYSQL driver not loaded. Why?
-
-
Hi,
Could you post what QSqlDatabase::lastError().text() returns ?
-
Then, can you post the code where you setup the database connection ?
-
[quote author="SGaist" date="1364418685"]Then, can you post the code where you setup the database connection ?[/quote]
Does it really matter? in first line when I'm trying to create a new database I got this error. I always connect this way, and it always works.
@
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); // This is the line I got error
db.setHostName("127.0.01");
db.setDatabaseName("test");
db.setUserName("root");
db.setPassword("pass");
bool ok = db.open();
@Note: I'm using my own build: http://sourceforge.net/p/eboqt/
-
Do you have the MySql client dll accessible in your PATH when running your program ?
-
-
SOLVED ... have to find and copy the libmysql.dll from the place MYSQL it is installed on the computer to the [QTDIR]/mingw482_32/bin/ folder.
Maybe its also working if you add the MYSQL install path to system variables?Just be sure you copy the good dll ...mean that if your Qt installed is 32 bits then will need the 32 bits dll too.
My first mistake was to copy the 64 bits dll and was not working -
SOLVED ... have to find and copy the libmysql.dll from the place MYSQL it is installed on the computer to the [QTDIR]/mingw482_32/bin/ folder.
Maybe its also working if you add the MYSQL install path to system variables?Just be sure you copy the good dll ...mean that if your Qt installed is 32 bits then will need the 32 bits dll too.
My first mistake was to copy the 64 bits dll and was not working@Sir.Costy For me worked by copying libmysql.dll from MYSQL folder to [QTDIR]/mingw482_32/bin/ folder.
Thanks male!