In Short: I am trying to link my Qt5.5 to MySQL but it is not working.
The long story begins when I tried to use MySQL as in:
QSqlDatabase theDatabase = QSqlDatabase::addDatabase("QMYSQL");
But when I run my application, I get the following messages:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
At this point, I looked online to see how to fix this.
Then I found on Qt Documentation that I need to build the MySQL plugin. So, I followed the guidance:
- I donwloaded
mysql-installer-community-5.7.19.0 - I tried to instal MySQL. However, during the installation, there was no
Libs & Include FilesModule to install !! - But I continued the installation and run MySQL57 succesfully as a service locally.
- I could not of course build the plugin because there is not
sqldriversfolder in my installed files.
I started looking all over the internet for solution. Then:
- According to this youtube answer, I needed to copy
libmysql.dllfromC:\Program Files\MySQL\MySQL Server 5.7\bintoC:\Qt\Qt5.5.1\5.5\mingw492_32\bin
I run my application, but again I have the same error !! So:
- I copied the file
libmysql.dllfromC:\Program Files\MySQL\MySQL Connector.C 6.1\libto the same locationC:\Qt\Qt5.5.1\5.5\mingw492_32\bin,
However, again I have the same error.
I am now stuck, don't know what to do.
P.S.: I have sql in my .pro file in Qt-application
libmysql.dlland trying using that one. Actually I faced this problem on GNU/Linux and rebuilding Qt solved my case. - rakib_