Sample Header Ad - 728x90

QSqlDatabase: QMYSQL driver not loaded error in zorin os

0 votes
1 answer
772 views
Recently I have installed Zorin os and qt creator from enter link description here I am using qt creator and here is my sample code to connect the MySQL database. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); db.setHostName("localhost"); db.setDatabaseName("csms"); db.setUserName("root"); db.setPassword(""); bool ok = db.open(); if(ok) { qDebug() << "Database connected." << Qt::endl; } else { qDebug() << "Database connection error." << db.lastError ()<< Qt::endl; } But failed. I am googling the last two days but no luck. Now I am here. I need help.
Asked by coder_hasib (11 rep)
Sep 10, 2022, 10:57 AM
Last activity: Sep 10, 2022, 04:27 PM