How to install MySQL C ++ driver on Windows

I had a question because my code did not work due to the lack of mySQL driver installed.

now I downloaded the latest version of mysql and have qt 5.0.1, however the Qt documentation or something else I can find is just not suitable for 5.0.1 showing all of these paths that are simply missing in 5.0. 1 build and I can’t find what needs to be done to just install this driver.

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

early

0
c ++ mysql qt
source share
2 answers

First of all you need to find where you installed mysql. I assume this will be somewhere in your Program Files . There you will see two folders: include and lib . If not, you have not installed the mysql version of the developer. Do not worry, just run the mysql installation again, select the update for the current installation and remember to check the "developer-something" in the wizard.

Now suppose you did everything right, and you found the mysql include and lib directories. Remember them (we will need them a bit later). Now you go into your Qt directory and find the driver sources there: ./Src/qtbase/src/plugins/sqldrivers/mysql .

Now follow a few steps:

  • Open cmd and change to the mysql driver source directory
  • Enter qmake "INCLUDEPATH+=C:/MySQL/include" "LIBS+=C:/MySQL/lib/libmysql.lib" mysql.pro , where 'C: / MySQL / include' is your path to mysql include and 'C: / MySQL / lib 'is your path to mysql lib.
  • Type nmake (or make if you are using mingw)
  • Type nmake install (or make install )
  • Add your mysql lib path to your PATH system
  • Reboot

After that, everything should work fine.

+1
source share

Just download 5.0.2 because it really works and has a path that the documentation shows.

0
source share

All Articles