Qt World Summit: Register Today!

Can we work with MySQL?

  • Is there support in Qt SQL for MySql? I don't see a specific driver for this...


    Juan Dent

  • @jdent The driver should be in <INSTALLED FOLDER>/PLUGINs/sqldrivers
    The Name should be something like: qsqlmysql4.dll at least for the QT 4.8x versions.
    If you do not found it, you need to build the QT driver.

  • Ok, looking at that address in m y computer (Mac Pro), I see the following dynamic link libraries (which end in dylib in Apple's OS X system):


    So, it seems there is a driver for MySql!! But, the enumeration for DbmsType does not include MySQL???

    This seems contradictory..

    Any ideas?


  • @blaisesegbeaya

    Where could I find detailed instructions as to how to create a QT driver - should that be necessary??


  • @jdent Hi!

    There is no need to write your own MySQL driver. Qt has a plugin for MySQL since very long ago and it's stable and just works and everyone uses it. :-)

    Here is the list of all supported databases. I guess the MySQL plugin can also talk to MariaDB but I'm not sure about that.

    Are you using a precompiled Qt environment or have you compiled Qt youself? If you've built it yourself and you're now missing the MySQL plugin then this is either caused by missing dependencies (MySQL development headers) or misconfiguration during the build process.

  • Lifetime Qt Champion


    The most likely situation: you have either MySQL installed through brew, MacPorts or even from the package on their website and it's not the same version nor the same path than the one used to build Qt.
    Run otool -L on libsqlmysql.dylib to see what's the status.

Log in to reply