I can not connect to mysql database
This is console result:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
Had the same problem => Plugin QMYSQL & QMYSQL 3 were available but couldn't load them :
"QSqlDatabase: QMYSQL driver not loaded / QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7"
Works for me on Windows with Qt SDK 5.6.0 (32bit version with mingw 4.9.2 32bit included) :
- Downloaded MySQL 32bit in zip archive (mine was v5.7.11)
- Extracted it to C:/MySQL
- Copied "C:\Qt\QMySQL\lib\libmysql.dll" and "C:\Qt\QMySQL\lib\libmysqld.dll" to Windows/System32 (to avoid the "cannot found -llibmysql" compilation error)
- Compile with "How to Build the QMYSQL Plugin on Windows" on http://doc.qt.io/qt-5/sql-driver.html#qmysql (my command was "qmake "INCLUDEPATH+=C:\Qt\QMySQL\include" "LIBS+=C:\Qt\QMySQL\lib\libmysql.lib" sql.pro" and "mingw32-make")
- After compilation succeeded, copy (the freshly compiled) Qt5Sql.dll & Qt5Sqld.dll from "C:\Qt\Qt5.6.0\5.6\Src\qtbase\lib" to your application build directory
- Restart QtCreator, that should work
Can you please provide some more information?
Which operating system are you using? Whats the Qt version? Maybe you also can provide the piece of code how you try to access the database?
If I may, copying libraries to Windows/System32 even if easy is a really bad idea. You can wreak havoc on other software doing that.