Answer the question
In order to leave comments, you need to log in
Qt. QSqlDatabase: QMYSQL driver not loaded. Why? How to fix?
The code:
#include <QtWidgets>
#include <QtSql>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication App(argc,argv);
MainWindow *Window = new MainWindow;
Window->show();
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL","mydb");
db.setHostName("localhost");
db.setDatabaseName("institute");
db.setUserName("root");
db.setPassword("1234");
bool ok = db.open();
int result = App.exec();
delete Window;
return result;
}
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
configure -plugin-sql-mysql -I C:\Program Files\MySQL\MySQL Server 5.7\include -L C:\Program Files\MySQL\MySQL Server 5.7\lib
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question