How to connect Mariadb with Qt on Fedora
Unsolved
Wiki Discussion
-
Hello , I'm using Fedora 29 , and trying to connect mariadb with qt but it's failing
after using
$ locate Trainingdb // the name of database
it prints /var/lib/mysql/TrainingdbQSqlDatabase db = QSqlDatabase::database( "QSQLITE","Trainingdb");
db.setHostName("localhost") ;
db.setUserName("root");
db.setPassword("mostafa");
db.setDatabaseName("/var/lib/mysql");if(db.open()){ QMessageBox::about(this,"sql", "Connected" );
}else {
qDebug() << db.lastError().text(); QMessageBox::about(this,"sql","not Connected"); } if(QFile::exists("db")) { QString S = "good" ; qDebug() << S; }else { qDebug() << " error "; } QSqlQuery qrry(db);
but when i use only
QSqlDatabase db = QSqlDatabase::serDatabase( "QSQLITE") ;it connected but there are no tables or anything in this QSQLITE even i guess there is no QSqlite otherwise it came with qt , Thanks in advance
-
Hi and welcome to devnet,
Why are you trying to connect to a MariaDB server using the SQLite plugin ?
You should be using the MySQL plugin.