QT MySql connectivity using Windows XP, Qt Creator 4.5.2(windows 32 bit)

Samir picture Samir · Oct 7, 2009 · Viewed 10.9k times · Source

Platform:

  • Windows XP
  • Qt Creator IDE 4.5.2

MySQL is setup here as well.

I want to establish database connection with Qt and MySQL. The following line

QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");

generates error like below:

QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC

It seems QMYSQL driver is absent here. What to do?

Answer

Lukáš Lalinský picture Lukáš Lalinský · Oct 7, 2009

You need to build the Qt/MySQL driver. See the documentation.