Qt 5.1.0 and MySQL 5.5.32 "Driver not loaded"
-
QPluginLoader says "Unknown error" to me too. So, I think it can load library.
I don't understand what the hell is on your machine.
I have Debian 7.0.
Everything what I do was:- Installed Qt 5.1
- Installed libmysql++3 libmysqlclient-dev libmysql++-dev
- Checked libraries by ldd.
- Installed libicu-dev
- Tryied QPluginLoader to understand, that I had libmysqlclient, but incorrect version.
- Installed this package from Ubuntu (sic!)
Now I removed plugins folder from my Server. So I have single binary file, and it works.
Yet another idea:
- Delete any libraries from your program.
- Try QPluginLoader on ~/Qt/5.1.1/gcc/plugins/sqldrivers/libqsqlmysql.so
It is also strange, that you did not have precompiled plugin, because I had.
-
[quote]It is also strange, that you did not have precompiled plugin, because I had. [/quote]
I had precompiled plugin, but the command ldd show dependency
inconsistency. That's why I compiled it manually.[quote]2) Installed libmysql++3 libmysqlclient-dev libmysql++-dev[/quote]
All these packets are newest in the system.[quote]4) Installed libicu-dev[/quote]
Ok, I did not have this packet, now it has been installed.
But the result is the same, "Driver not loaded Driver not loaded" .[quote]1) Delete any libraries from your program.
2) Try QPluginLoader on ~/Qt/5.1.1/gcc/plugins/sqldrivers/libqsqlmysql.so[/quote]
I did it. This is my connection code
@
db = new QSqlDatabase();
db->addDatabase("QMYSQL");
db->setHostName("localhost");
db->setDatabaseName("myclinic");
db->setUserName("root");
db->setPassword(",trth12");QPluginLoader loader("/home/test/Qt/5.1.1/gcc/plugins/sqldrivers/libqsqlmysql.so"); loader.load(); qDebug() << loader.errorString(); qDebug() << "drivers: "<< QSqlDatabase::drivers(); if (db->open()) qDebug() << "Success!"; else qDebug() << db->lastError().text();@
This is output text
@Starting /home/test/QtProjects/build-MySQLGUI-Desktop_Qt_5_1_0_GCC_32bit-Debug/MySQLGUI...
"Unknown error"
drivers: ("QSQLITE", "QMYSQL", "QMYSQL3", "QPSQL", "QPSQL7")
"Driver not loaded Driver not loaded" @These commands I have done in system console
@test(at)penguin:~/Qt/5.1.1/gcc/plugins/sqldrivers$ ls
libqsqlite.so libqsqlmysql.so libqsqlpsql.so
test(at)penguin:~/Qt/5.1.1/gcc/plugins/sqldrivers$ ldd libqsqlmysql.so
linux-gate.so.1 => (0xb7764000)
libmysqlclient.so.18 => /usr/lib/i386-linux-gnu/libmysqlclient.so.18 (0xb741e000)
libQt5Sql.so.5 => /home/test/Qt/5.1.1/gcc/lib/libQt5Sql.so.5 (0xb73de000)
libQt5Core.so.5 => /home/test/Qt/5.1.1/gcc/lib/libQt5Core.so.5 (0xb6f5a000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb6e75000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb6ccb000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb6cb5000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb6cb0000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb6c94000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6c68000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6c4a000)
libicui18n.so.51 => /home/test/Qt/5.1.1/gcc/lib/libicui18n.so.51 (0xb6a28000)
libicuuc.so.51 => /home/test/Qt/5.1.1/gcc/lib/libicuuc.so.51 (0xb68af000)
libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 (0xb68ab000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb68a2000)
libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb67a9000)
/lib/ld-linux.so.2 (0xb7765000)
libicudata.so.51 => /home/test/Qt/5.1.1/gcc/lib/libicudata.so.51 (0xb5260000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb5223000)
test(at)penguin:~/Qt/5.1.1/gcc/plugins/sqldrivers$ @