I'm using Qt 5.5 with MSVC plugin. I want to simply connect to a database. The code is -
Qt Code:
  1. QString hostName = "127.0.0.1";
  2. QString databaseName = "imagedatabase";
  3. QString userName = "demouser";
  4. QString userPass = "demopass";
  5.  
  6. QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
  7. db.setHostName(hostName);
  8. db.setDatabaseName(databaseName);
  9. db.setUserName(userName);
  10. db.setPassword(userPass);
  11.  
  12. bool ok = db.open();
To copy to clipboard, switch view to plain text mode 

But the following error occurs -

Qt Code:
  1. QSqlDatabase: QMYSQL driver not loaded
  2. QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
To copy to clipboard, switch view to plain text mode 

Then following some suggestion in the web - I copied the qsqlmysql.dll, qsqlmysqld.dll,libmysql.dll, libmysqld.dll files to the project folder. -that didn't work. According to another thread here - I have to put mysqlclient.lib where my application executable is. But I use a wampserver mysql where I don't have a mysqlclient.lib file.
How can I complete this simple task?