PDA

View Full Version : QT 5.7 and MYSQL On Centos 7 - Driver Not Loaded



joker72
27th August 2016, 22:39
Getting the old....

QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7

I think everything is installed correctly. Any help would be appreciated.



#include <QCoreApplication>
#include <QSqlDatabase>
#include <QDebug>
#include <iostream>

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);

QSqlDatabase db(QSqlDatabase::addDatabase("QMYSQL3"));

//QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("127.0.0.1");
db.setDatabaseName("QTTest");
db.setUserName("root");
db.setPassword("BOSS");
bool ok = db.open();

qDebug() << ok;


return a.exec();
}


Thanks!

d_stranz
29th August 2016, 16:14
Do you have the MySQL client library (https://dev.mysql.com/downloads/connector/cpp/) installed where the QMYSQL3 plugin can find it? On Windows, this will be named "libmysql.dll". It needs to be in the same directory as your executable (or in the PATH environment variable). On linux, it will probably be the same name, different extension. Still needs to be "findable" at runtime.

MBereznyak
18th September 2016, 16:25
I have the same problem.
Dose anybody solve it?

Thanks.

rahulvishwakarma
10th November 2017, 17:25
perhaps this link will solve your problem
http://www.qtcentre.org/threads/68901-mysql-plugin-not-compiling-from-source?highlight=mysql

d_stranz
25th November 2017, 17:12
@mersadwebseo: Reported for spamming.