1

I'm new here I want to run this code :

QApplication a(argc, argv);
QSqlDatabase::addDatabase("QMYSQL");
teste w;
w.show();
return a.exec();

when I try to run it I become this fault

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

I have window7, 32 bit System , Msql 5.1.72, qt.5.1.1, visual Studio 2010

Any advice please ?

zessx
  • 68,042
  • 28
  • 135
  • 158
The Man
  • 407
  • 1
  • 7
  • 19

2 Answers2

1

The error message hints that you have missed the QMYSQL plugin. You may take a look at Qt Documentation on how to build it on Windows.

vahancho
  • 20,808
  • 3
  • 47
  • 55
0

Sometimes it is only need to Copy libmysql.dll from %mysql%\lib to C:\Windows

Raja Simon
  • 10,126
  • 5
  • 43
  • 74
garry
  • 1