Qsqldatabase:qmysql Driver not loaded solution

Source: Internet
Author: User

When using a database connection in QT 5, the following error pops up:

Qsqldatabase:qmysql Driver not loaded

Qsqldatabase:available drivers:qsqlite qmysql QMYSQL3 qodbc QODBC3 qpsql QPSQL7

As can be seen from the above error, the error occurs when the MySQL database driver is not loaded.

There are two general cases of this error:

The first type: no MySQL driver, then check the Qt\5.3\msvc2013_64_opengl\plugins directory for Qsqlmysql.dll, if not, it means that Qt does not have the corresponding MySQL driver. At this time, in qsqldatabase:available drivers:qsqlite qmysql QMYSQL3 qodbc QODBC3 qpsql QPSQL7 Error, there is no qmysql item.

The workaround is to copy the Qmysql.dll to the plugins directory. How do I get it? http://blog.163.com/e_rommel/blog/static/187383045201292422139149/or Http://dev.wo.com.cn/bbs/viewthread.jsp?tid =140945&extra=page%3d1.

The second type: library support is not perfect.

The workaround is to copy the Libmysql.dll under Mysql\mysql Server 5.7\lib to Qt\5.3\msvc2013_64_opengl\bin.

Qsqldatabase:qmysql Driver not loaded solution

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.