QMYSQL driver not loaded
-
Hello, I would like to connect in a local database, i use MySql/phpMyAdmin with XXAMP in ubuntu, i configure the file my.cnf and add the line bind-adress = 192.168.56.1
My source :
m_db.setPort(3306); m_db.setHostName("192.168.1.15"); m_db.setUserName("Test"); m_db.setPassword("12345"); m_db.setDatabaseName("Gestion"); if(!m_db.open()) { qDebug()<<m_db.lastError().text(); m_db.close(); }
Output :
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7Thank
-
Hi,
Please take the time to search the forum, this question has been asked many times over the years and recently.
You likely have more a recent version of the MySQL client libraries that the one used to build the plugin. You can check that by running ldd on the Qt MySQL plugin. If so then install the MySQL client libraries dev package and rebuild the plugin (only the plugin there's no need to build of all Qt).
-
Do you have the MySQL .dlls folder in your PATH ?
If not then they won't be found when you start your application thus the plugin can't be loaded.
You can modify the PATH environment variable in the Run part of the Project panel in Qt Creator.
-
- You must download mySqlCConnector
https://forum.qt.io/topic/75763/cannot-connect-to-mysql-server/9
- You must download mySqlCConnector
-
You're welcome !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)