简体   繁体   中英

How to connect QT and MariaDB. driver not loaded

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述 在此处输入图像描述

在此处输入图像描述

Same "QMYSQL driver not loaded" error.

But others people see the QMYSQL in the "QSqlDatabase: available drivers" message.

Why I don't even have it?

The first thing is to download the connector installer, depending on the version of the compiler you are using, 64 or 32 bits, for c from here: https://downloads.mysql.com/archives/cc/

locate the connector installation folder and run these commands.

cd% QTDIR% \ qtbase \ src \ plugins \ sqldrivers

qmake - MYSQL_INCDIR = "C: / Program Files / MySQL / MySQL Connector C 6.1 / include" MYSQL_LIBDIR = "C: / Program Files / MySQL / MySQL Connector C 6.1 / lib"

mingw32-make

mingw32-make install

Here you can see the official Qt documentation. https://doc.qt.io/qt-5/sql-driver.html#qmysql

and with that you would have everything ready, good luck.

note. don't forget to include the sql module in your.pro file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM