thecodemonkey86 / qt_mysql_driver

Typical symptom: QMYSQL driver not loaded. Solution: get pre-built Qt SQL driver plug-in required to establish a connection to MySQL / MariaDB using Qt. Download qsqlmysql.dll binaries built from official Qt source code
Other
417 stars 58 forks source link

Tutorial #12

Closed dndrade closed 3 years ago

dndrade commented 3 years ago

Any chance there's an update video on how to properly do it? It's not working on my end.

thecodemonkey86 commented 3 years ago

Hi, I'm gonna need more information what exactly does not work, which version you use, what you have tried so far, etc. Maybe there are some hints in the console output, if you set the QT_DEBUG_PLUGINS environment variable to value = 1, in Qt Creator project run settings: image

dndrade commented 3 years ago

thanks for getting back to me! I was using QT 6.0.3. But Now I'm trying to make it work on an older version (5.11). The console output was always the same: QMYSQL driver not loaded. I have tried to put the files on the bin folder, as well as the project folder and none worked. Since I'm fairly new to QT, I'm thinking that I must be missing something on how to do the proper set up. I'm doing this for my honors project at college, is there anyway you could walk me trough this set up if you're available? Like a paid one hour tutoring?

thecodemonkey86 commented 3 years ago

Actually there is not that much to set up. You only need to make sure that you use the correct version of the files provided here (Matching Qt version, matching compiler: MSVC or MinGW, and matching bitness: 32 bit or 64 bit. For example I don't provide the SQL driver files for Qt 5.11 (since it is outdated). I show you screenshots of my sample project:

In this example I set the Qt version to 6.0.4 and MSVC 64 bit compiler image in that case you require the corresponding files from here image

The debug build directory looks like this image

and contains the project executable (in my case qttest2.exe), libmysql.dll, libcrypto-1_1-x64.dll, libssl-1_1-x64.dll plus a subdirectory "sqldrivers" that contains the debug build of qsqlmysql (i.e. qsqlmysqld.dll)

image

That should be all to set up

dndrade commented 3 years ago

I have followed the instructions, and this is how my project looks like: image

Now, QMYSQL appears on the list of the drivers, but still doesn't load.

image

This is how I'm trying to access the db

image

dndrade commented 3 years ago

So I've just realized, that since when I tried with the 5.11 didn't work. I reinstalled the latest version, an in a matter of days it went from 6.0.3 to 6.0.4 to 6.1.0 (which is my current version). This is probably why I'm getting the drivers listed but not loading, correct?

thecodemonkey86 commented 3 years ago

I didn't make a release for version 6.1.0 yet, so it can't be used just yet

dndrade commented 3 years ago

Got it! I'm already happy that the drivers are showing on the list. That's progress! I'll be on the look out for your next release so I can try again. Thank you so much!

thecodemonkey86 commented 3 years ago

The release for 6.1.0 MinGW is here

dndrade commented 3 years ago

It WORKED! You are the best!!! Thank you so much! You saved my school project. <3

thecodemonkey86 commented 3 years ago

I'm glad I could help