如何在Windows上安装MySQL c ++驱动程序 [英] How to install MySQL c++ Driver on Windows
问题描述
我有一个问题,因为我的代码没有工作,由于没有安装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:
- 打开cmd并进入mysql驱动程序的源目录
- 键入
qmakeINCLUDEPATH + = C:/ MySQL / includeLIBS + = C:/MySQL/lib/libmysql.libmysql.pro
,其中'C :/ MySQL / include'是mysql的include的路径,'C:/ MySQL / lib'是你的mysql lib的路径。 - 键入
nmake $ <$ c> 如果您使用的是mingw,则
(或 make
) - 键入
nmake install
(或make install
) - 将您的mysql的lib路径加入您的系统PATH
- 重新启动
- Open cmd and proceed to mysql driver's source directory
- 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. - Type
nmake
(ormake
if you're using mingw) - Type
nmake install
(ormake install
) - Add your mysql's lib path to your system PATH
- Reboot
之后,一切都应该正常。
After that, everything should work fine.
这篇关于如何在Windows上安装MySQL c ++驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!