Deploy qt mysql application

I have developed an application using Qt + MySQL.

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

      

I have successfully compiled the mysql drivers, my application is working and everything is fine. Now I am trying to deploy my application, distributing all the required DLLs along with it.

So far I have included:

platforms/qwindows.dll
icudt52.dll
icuin52.dll
icuuc52.dll
libgcc_s_dw2-1.dll
libstdc++-6.dll
libwinpthread-1.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Sql.dll
Qt5Widgets.dll
libEGL.dll     // not needed but included anyway
libmysql.dll   // compiled drivers

      

Now, to test it, I'll rename the folder C:\Qt

to something else (i.e. C:\Qthidden

). I run my application, but when it starts, it cannot connect to the database (I am testing it on the same machine that I created the program on which the MySQL server is running).

I also tried to enable qsqlmysql.dll

, but it doesn't change anything.

I am currently using Qt 5.3 and MySQL 5.5.

Any ideas? Thank you for your time.

EDIT: connection.lastError().text();

says "Driver not loaded". What am I missing?

+3


source to share


1 answer


You should place qsqlmysql.dll

in a directory named sqldrivers

next to the executable.



+2


source







All Articles