I am new to Qt and am trying to use the mysql database on a windows installation. I have already spent too much time and can't sort it out.
I have QTPLUGIN += qsqlmysql and QT += sql in the .pro file. When I load the project I get a message. two of them that it is redundant. It isn't any better when I leave the line out. I checked in the plugin directory and it is there.
I also have the -llibmysql entry added to the LIBS's path
win32:CONFIG(release, debug|release): LIBS += -L"C:/Program Files/MariaDB 10.1/lib/" -llibmysql
The application seems to build correctly.
my database access is copied from somewhere:
Qt Code:
bool createConnection() { db.setHostName("localhost"); db.setDatabaseName("testdb"); db.setUserName("root"); db.setPassword("rmsipw"); if (!db.open()) { qDebug() << "Database error occurred"; return false; } return true; }To copy to clipboard, switch view to plain text mode
when it runs I get:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QODBC3
Database error occurred
Not Connected:
Edit:
It is way more complicated then this: My application wants to compile with an old version of mingw on my machine. Even though the default kit is Desktop Qt 5.7.0 MSVC2013 64bit is the default Kit?
Bookmarks