Qt Windows Qsqldatabase Qmysql Driver Not Loaded

17.09.2019by admin

How to solve (QSQLDatabase:: QPSQL Driver not loaded) problem in windows?;QT Topic. Copy these 5 dll files into the sql driver folder of the QT installation folder. How to find the QT dependencies?or How to use Qt executables without installing QT?or Simply How to delpoy QT easily in windows? MS Visual c 6.0:How to add Image/Logo. When I run the code QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7 Database is Not Connected!

Wapdam taken 3 game download. Hello to all!
I mention that I have installed Qt 5.12.1 and I receive an error when I am trying to build QMYSQL plugin for Windows 10.
The path to sql drivers is 'c:QtQt5.12.15.12.1mingw73_64pluginssqldrivers', and also the path to lib files is 'c:Program FilesMySQLMySQL Server 8.0lib'
I opened a cmd window and typed the folowing c:QtQt5.12.15.12.1mingw73_64pluginssqldrivers>qmake -- MYSQL_INCDIR=C:/MySQL/include 'MYSQL_LIBDIR=C:/MYSQL/MySQL Server 8.0/lib/' mysql.pro

but no success
Give me a clue!
Thank you!

Loaded
Active2 years ago

I've just done developing a QT CRUD Application. I am using SQLite to store the information locally in my disk where the application is running. This way my application works fine.

But the app lack the the a central database server. Therefor, I started by installing MySql-server and MySql-workbench. I imported my DB in the workbench and made sure the server is running.

Now on Qt, I wrote the following lines to conenct to my server on the 'localhost ' using port '3306' as follow:

Driver

However, I get the following error on QT 'Application Outout ':

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

I tried to make sure that libmysql.dll is located in 'C:Program FilesMySQLMySQL Server 5.7lib' .

I copied it also to 'C:UsersAbubakrDocumentsGitHubDEBUGbuild-Muwassa-Desktop_Qt_5_4_2_MinGW_32bit2-debug'

but it is not working at all.

Please help !!

McLan
McLanMcLan
1,2796 gold badges30 silver badges59 bronze badges

1 Answer

You need to build the QMYSQL driver by yourself first.

When you download Qt you have also the source that are provided with it.

In my case, it is in : C:Qt5.9SrcqtbasesrcpluginssqldriversmysqlHere you have a *.pro (that is a kind of makefile generator). You just have to open it with QtCreator, Compile it and you will get a dll. This dll is the MySQL driver and must be in the same dirent of your application.

To do that, if you have a problem with the compilation (like mysql.h not found), you must 'install' mysql library also.

In Linux you can have the same issue as well.

Qsqldatabase Available Drivers

Antoine MorrierAntoine Morrier
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Qsqldatabase

Not the answer you're looking for? Browse other questions tagged c++mysqlqtsqlite or ask your own question.