Qsqldatabase:qmysql Driver not loaded solution (normal under Debug, release error)

Source: Internet
Author: User

Environment:

QT 5.11

Mysql 5.5

MSVC 2015 compiler

All of the above are 64-bit

Symptoms are:

Connection database is normal under Debug, the database failed to connect under release

Tips are as follows:

Qsqldatabase:qmysql driver not loadedqsqldatabase:available drivers:qsqlite qmysql QMYSQL3 qodbc QODBC3 qpsql QPSQL7

Note that there is no need to manually compile MySQL driverin this case, because QT has its own

According to the various methods on the Web, paste the DLL everywhere, including the EXE sibling directory, and the main under add

Qapplication::addlibrarypath ("./plugins");

etc... And Fq looked at a variety of methods, tossing all morning useless.

Final Solution:

Download mysql-connector-c on the MySQL website https://dev.mysql.com/downloads/connector/c/

(Mysql-connector-c-6.1.11-winx64.msi)

Install and then add the. qrc file in the QT project

6.1+ =-l$$"C:\Program files\mysql\mysql Connector C 6.1\lib"

Purge, re-qmake, build, open discovery still fails, and debug succeeds.

No fruit, finally delete the project's release folder, re-release under Build, run, success.

Then pack and publish, everything works.

..

Qsqldatabase:qmysql Driver not loaded solution (normal under Debug, release error)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.