Qt 5 Connection to database MySQL don't work ?
Hey all, I am working on a PDA management desktop application using Qt 5 and I have a problem my qt connection to mysql database didn't work and i used all the examples that i found but it didn't work please can you please help me , thanks those are the images from my desk
Hey, did you put "libmysql.dll" into the build location of your Qt project?
Ideally, you can dynamically link it in your .pro. But, the quick solution is
- Find the "libmysql.dll" in your MySQL install location.
- Locate the build location of your Qt project which is usually at "build-(your project name)/debug" or "build-(your project name)/release"
Copy the "libmysql.dll" to the location and then run your project again.
If this does not fix it, let me know what error message it gives you this time.
yes i copy it to the project folder but it's still not ok
that the new error :
:-1: error: LNK1104: impossible d'ouvrir le fichier 'libmysql.lib'
thanks for your reply :)
This post is deleted!
Hi and welcome to devnet,
You need to add the path to libmysql.lib to your project DIR variable.
Out of curiosity, why do you link against this library ? Or are you building the MySQL plugin ?
@islam-ouahouda Problems with Dynamic Load Libraries are sometimes difficult to solve. The reasons can be quite different: due you use the correct version of the libraries, is the path to all the libraries correct or can the application find the library, etc. You can use the Dependency Walker from dependencywalker.com to find link errors between your application and libraries, or from libraries to other libraries. Please note the comment from SGaist: the Qt 5.4 and Qt 5.5 comes with the precompiled qsqlmysql.dll (release) and qsqlmysqld.dll (debug). The only other library you will need is libmysql.dll (note: dll at the end). If you put this last library next to your application it should work.
@islam-ouahouda Try this, http://seppemagiels.com/blog/create-mysql-driver-qt5-windows it worked for me