Qt 5.8 sql connection error: QMYSQL driver does not load in windows 10

When I tried to connect to mysql, an error occurred:

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

So, I searched for it, and I tried:

1.Copy sqldrivers folders for C: \ Qt \ Qt5.8.0 \ 5.8 \ mingw53_32 \ plugins

2.Copy libmysql.dll in C: \ Qt \ Qt5.8.0 \ 5.8 \ mingw53_32 \ bin

but the error still exists.

Is there something I don't see?

+5
source share
3 answers

There are 64-bit and 32-bit versions of libmysql.dll . rebuilding the Qt driver is NOT required .

With the pre-built version of Qt5.9.1, you still need to use the 32-bit version, it even worked with the 64-bit version of MySQL. without any rebuilding of plugins or QT components. Download the 32-bit MySQL connector here

This has already been answered: medasumanth answer

+4
source
  • You must rebuild the mysql driver.
  • Follow this guide

    Note: you need 3 things:

    a. qt-opensource-xxx-mingw492-xxx.exe for the Qt Creator and Qt team Tell me.

    b.qt-everywhere-opensource-src-xxx.zip for the Qt source code required for the mysql.pro file. c.mysql-connector-c-6.1.10-win32.zip required for the lib and include folder.

+1
source

This error usually means that the Qt MySQL plugin is fine (since it is listed in the available drivers), but you are missing a MySQL dll (thereby preventing the driver from loading).

The fix is ​​to place libmysql.dll somewhere in your PATH, for example. by adding the MySQL installation folder to PATH or copy libmysql.dll to the same folder in which you have exe.

0
source

Source: https://habr.com/ru/post/1265210/


All Articles