Qt:Windows 10:QMYSQL驱动程序未加载 [英] Qt: Windows 10: QMYSQL driver not loaded

查看:154
本文介绍了Qt:Windows 10:QMYSQL驱动程序未加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简而言之:我正在尝试将Qt5.5链接到MySQL,但是它不起作用.

In Short: I am trying to link my Qt5.5 to MySQL but it is not working.

长话始于我尝试使用MySQL的方式,

The long story begins when I tried to use MySQL as in:

QSqlDatabase theDatabase = QSqlDatabase::addDatabase("QMYSQL");

但是当我运行我的应用程序时,我收到以下消息:

But when I run my application, I get the following messages:

QSqlDatabase:未加载QMYSQL驱动程序

QSqlDatabase: QMYSQL driver not loaded

QSqlDatabase:可用驱动程序:QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

这时,我在网上看了看如何解决这个问题.

At this point, I looked online to see how to fix this.

然后我在 Qt文档上找到了构建MySQL插件.因此,我遵循了指导:

Then I found on Qt Documentation that I need to build the MySQL plugin. So, I followed the guidance:

  1. 我下载了mysql-installer-community-5.7.19.0
  2. 我试图安装MySQL.但是,在安装过程中,没有要安装的Libs & Include Files模块!
  3. 但是我继续安装并成功在本地将MySQL57作为服务运行.
  4. 我当然不能构建插件,因为安装的文件中没有sqldrivers文件夹.
  1. I donwloaded mysql-installer-community-5.7.19.0
  2. I tried to instal MySQL. However, during the installation, there was no Libs & Include Files Module to install !!
  3. But I continued the installation and run MySQL57 succesfully as a service locally.
  4. I could not of course build the plugin because there is not sqldrivers folder in my installed files.

我开始在互联网上寻找解决方案.然后:

I started looking all over the internet for solution. Then:

  1. 根据此 youtube答案,我需要从C:\Program Files\MySQL\MySQL Server 5.7\binC:\Qt\Qt5.5.1\5.5\mingw492_32\bin
  1. According to this youtube answer, I needed to copy libmysql.dll from C:\Program Files\MySQL\MySQL Server 5.7\bin to C:\Qt\Qt5.5.1\5.5\mingw492_32\bin

我运行我的应用程序,但是我又遇到了同样的错误!所以:

I run my application, but again I have the same error !! So:

  1. 我将文件libmysql.dllC:\Program Files\MySQL\MySQL Connector.C 6.1\lib复制到了相同的位置C:\Qt\Qt5.5.1\5.5\mingw492_32\bin
  1. I copied the file libmysql.dll from C:\Program Files\MySQL\MySQL Connector.C 6.1\lib to the same location C:\Qt\Qt5.5.1\5.5\mingw492_32\bin,

但是,我再次遇到相同的错误.

However, again I have the same error.

我现在被困住了,不知道该怎么办.

I am now stuck, don't know what to do.

P.S .:我在Qt应用程序的.pro文件中有sql

P.S.: I have sql in my .pro file in Qt-application

推荐答案

下载32位版本的libmysql.dll;请在此处查看详细信息: qt 5.8 sql连接错误:Windows 10上未加载QMYSQL驱动程序

Download the 32-bit version of libmysql.dll; check here for details: qt 5.8 sql connection error:QMYSQL driver not loaded on windows 10

这篇关于Qt:Windows 10:QMYSQL驱动程序未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆