Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

MySQL Windows for Current Qt Apps



  • Hi all,

    I've been all over the internet and the forums here to find a way to enable QMYSQL in Qt 5.13 or 5.11. Everything I find is years old and does not work as directed. Can someone point me in the right direction please.
    Thanks



  • https://doc.qt.io/qt-5/qtsql-index.html# doesn't answer your questions?

    It says that the mysql driver is enabled by default.



  • When I compile and run my program under the Windows environment I get the bloody QSqlDatabase: QMYSQL driver not loaded
    along with QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7 information. In Linux I had to install some mysql dev libs that were a few versions old but in windows all the references I found say that I need to download mysql developement libs and compile mysql against those libraries. Also, in the examples on that page they are using the QSQLITE for a database which I believe is app based and SMYSQL is not?

    Ugh, it shouldn't be this difficult.

    Edit: See https://doc.qt.io/qt-5/sql-driver.html#qmysql

    Thanks..



  • I had the same issue, this is what I did

    [https://forum.qt.io/topic/105351/qt5-12-3-mysql](link url)



  • @iceruam I followed that which lead to another problem, Qt's MySql plugin will not compile against the latest MySql server which is in the 8.0 range. After removing that and going back to a 5.x series I managed to get it to compile. Then I noticed that I already had the dll files in one of the mingw directories. I come across another post that mentioned putting them into the QtCreator's plugin folder but that didn't help either. It's weird that it shows the drive available in the error but won't load. It really shouldn't be this hard to use a feature... Still digging for the answer..



  • Okay, I got it working, 3 simple Steps

    1. Download the C Version of mysql connector.
    2. Place the 2 libmysql files from the extracted directory\lib directory into your \QT<version><compiler>\bin directory.
    3. Restart QtCreator.

    Viola all working as expected.

    In Linux I had the issue of the wrong version of the library installed a simple ld showed me I needed version 18 installed and had 20 installed. And in windows, well it took 3 days of googling to figure this one out.

    Thanks all for your help..


Log in to reply