如何在Windows上安装MySQL c ++驱动程序 [英] How to install MySQL c++ Driver on Windows

查看:300
本文介绍了如何在Windows上安装MySQL c ++驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,因为我的代码没有工作,由于没有安装mySQL驱动程序。

I had a question before because my code didnt work due to no mySQL driver being installed.

现在我已下载最新版本的mysql和qt 5.0。 1然而文档Qt或任何其他我可以找到只是不正确的5.0.1它显示所有这些dir路径只是在5.0.1构建,我不能找到只做安装此驱动程序

now i have downloaded the latest version of mysql and have qt 5.0.1 however the documentation on Qt or anything else i can find is just not right for 5.0.1 its showing all these dir paths that just arent in the 5.0.1 build and i cant find what to do to just install this driver

任何帮助会真的很好,im使用windows 7 pro btw

any help would be really good, im using windows 7 pro btw

提前感谢

推荐答案

首先,你需要找到你安装mysql的位置。我想这将是在你的程序文件的某个地方。在这里你会看到两个目录: include lib 。如果没有 - 比你还没有安装开发版本的mysql。不要担心,只需再次运行mysql安装,选择更新当前安装,并​​确保在向导中检查'developer-something'。

First of all you need to find where you have installed mysql. I guess it would be somewhere in your Program Files. There you will see two directories: include and lib. If not - than you haven't installed the developer version of mysql. Don't worry, just run mysql installation once again, select updating your current install and be sure to check 'developer-something' in the wizard.

现在假设,你做了一切正确,你发现mysql include lib 目录。记住他们(我们稍后会需要他们)。现在你去你的Qt的目录,并找到驱动程序的来源在那里: ./ Src / qtbase / src / plugins / sqldrivers / mysql

Now let's assume, you did everything right, and you found mysql include and lib directories. Remember them (we'll need them a bit later). Now you go to your Qt's directory, and find driver's sources somewhere there: ./Src/qtbase/src/plugins/sqldrivers/mysql.

现在执行以下几个步骤:

Now do several steps:


  1. 打开cmd并进入mysql驱动程序的源目录

  2. 键入 qmakeINCLUDEPATH + = C:/ MySQL / includeLIBS + = C:/MySQL/lib/libmysql.libmysql.pro ,其中'C :/ MySQL / include'是mysql的include的路径,'C:/ MySQL / lib'是你的mysql lib的路径。

  3. 键入 nmake 如果您使用的是mingw,则(或 make

  4. 键入 nmake install (或 make install

  5. 将您的mysql的lib路径加入您的系统PATH

  6. 重新启动

  1. Open cmd and proceed to mysql driver's source directory
  2. Type qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MySQL/lib/libmysql.lib" mysql.pro, where 'C:/MySQL/include' is your path to mysql's include and 'C:/MySQL/lib' is your path to mysql's lib.
  3. Type nmake (or make if you're using mingw)
  4. Type nmake install (or make install)
  5. Add your mysql's lib path to your system PATH
  6. Reboot

之后,一切都应该正常。

After that, everything should work fine.

这篇关于如何在Windows上安装MySQL c ++驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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