I've just done developing a QT CRUD Application. I am using SQLite to store the information locally in my disk where the application is running. This way my application works fine.
But the app lack the the a central database server. Therefor, I started by installing MySql-server and MySql-workbench. I imported my DB in the workbench and made sure the server is running.
Now on Qt, I wrote the following lines to conenct to my server on the "localhost " using port "3306" as follow:
db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("localhost");
db.setPort(3306);
db.setDatabaseName(databaseName);
db.setUserName(userName);
db.setPassword(userPass);
qDebug() << appDataPath;
if (!db.open()){
return db.lastError().text();
}
However, I get the following error on QT "Application Outout ":
QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
I tried to make sure that libmysql.dll
is located in "C:\Program Files\MySQL\MySQL Server 5.7\lib" ..
I copied it also to "C:\Users\Abubakr\Documents\GitHub\DEBUG\build-Muwassa-Desktop_Qt_5_4_2_MinGW_32bit2-debug"
but it is not working at all.
Please help !!
C:\Program Files\MySQL\MySQL Server 5.7\lib
in your system path? – drescherjmlib
folder is stated in my system path variable.... Sorry also about asking for tutorial, I agree with yo u (I'll remove the request) – McLan