Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Problem Loading QMYSQL driver in my Qt Quick project.
carles.sole.grau last edited by carles.sole.grau
I'm trying to connect to a MySQL database so in my main.cpp file I added this code:
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName("example"); db.setDatabaseName("example"); db.setUserName("example"); db.setPassword("mypassord"); if(!db.open()) qWarning( "Connection FAILED." );;
When I execute all the project (Qt Quick):
QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7 Connection FAILED.
It seems like Qt knows QMYSQL driver is available but it doesn't load it.
I find some information in the forum but it doesn't help me,
Does anyone know how to fix it? I'm using Qt 5.6 in Ubuntu 16.04-
Thank you very much.
That has nothing to do with QtQuick.
Did you install MySQL's client libraries ? If so then run ldd on the Qt's MySQL plugin. You'll likely find that the client library used to build Qt is older than the one you have installed on your machine.