4
I am trying to connect to the database with Qtcreator as follows:
this->db = QSqlDatabase::addDatabase("QMYSQL");
this->db.setHostName("localhost");
this->db.setDatabaseName("Pessoa");
this->db.setUserName("root");
this->db.setPassword("");
if(this->db.open();
But the application returns:
Qsqldatabase: QMYSQL driver not Loaded Qsqldatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
I already installed the qt-mysql
and no . pro QT += sql
. What I must do beyond that to have connection?
Obs.:
Version of Qt = 5.2.1
OS = GNU/Linux Fedora
Did you check whether the
qt-mysql
accessible in PATH? If you installed while Qt was open, you need to restart Qt (at least on Windows).– Lucas Lima
I added the path to the environment variable, but still keeps returning the same error.
– Gabriel Custódio