QSqlDatabase: QMYSQLdrivernotloadedQSqlDatabase: availabledrivers: QSQLITE solution. Check whether libqsqlmysql. so [test1 @ localhost ~] has been installed. $ Locatelibqsqlmysql. sovarcacheabrt-diusrlibdebugusrlibqt4pluginssqldriverslibqsqlmysql.so.
QSqlDatabase: QMYSQLdrivernotloaded QSqlDatabase: availabledrivers: QSQLITE solution. Check whether libqsqlmysql. so [test1 @ localhost ~] has been installed. $ Locatelibqsqlmysql. so/var/cache/abrt-di/usr/lib/debug/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql. so.
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE
Solution: Check whether libqsqlmysql. so has been installed.
[Test1 @ localhost ~] $ Locate libqsqlmysql. so
/Var/cache/abrt-di/usr/lib/debug/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql. so. debug
I have not installed it on my system. Install the qt-mysql.i686 below.
[Root @ localhost test1] # yum install qt-mysql.i686
========================================================== ==========================================================
Package Arch Version Repository Size
========================================================== ==========================================================
Installing:
Qt-mysql i686. 7.4-7. fc14 updates 67 k
[Root @ localhost test1] # updatedb
[Test1 @ localhost ~] $ Locate libqsqlmysql. so
/Usr/lib/qt4/plugins/sqldrivers/libqsqlmysql. so
/Var/cache/abrt-di/usr/lib/debug/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql. so. debug
Call in the program
QDebug () <
You can see the path of the Qt Search Library. No/usr/lib/qt4/plugins/
There are two ways to solve this problem:
1. Add the path of libqsqlmysql. so to the library path:
QcoreApplication: addLibraryPath ("/usr/lib/qt4/plugins /");
2. Directly copy libqsqlmysql. so to the search path of Qt.
[Test1 @ localhost ~] $ Cp/usr/lib/qt4/plugins/sqldrivers/libqsqlmysql. so QtSDK/Desktop/Qt/4.8.1/gcc/plugins/sqldrivers/
Http://doc.qt.nokia.com/4.7-snapshot/sql-driver.html