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

Qt MYSQL plugin not loaded



  • I'm building a CentOS 8 Qt 5.12.8 application that uses MariaDB. I've built the MySQL plugin using the methods described here: https://doc.qt.io/qt-5.12/sql-driver.html. I ran make and make install, and it works to create a libqsqlmysql.so library file. My application builds without error, and successfully connects to the database on my build machine.

    The problem occurs when running my binary on a server that does not have Qt installed, ie a fresh install of CentOS 8. The MYSQL plugin is not loaded, with an error message "Driver not loaded". I've tried putting the libqsqlmysql.so file in the following locations (where binpath is the location of my binary program), and none work:

    /usr/lib

    <binpath>/plugins

    <binpath>/plugins/sqldrivers

    ~/Qt/5.12.8/gcc_64/plugins/sqldrivers

    I've also run ldd on my binary, and it does not list libqsqlmysql.so as one of the dependencies. Did I not build my application correctly? Where should I put the libqsqlmysql.so on the target machine?



  • @GregB
    Always start by going export QT_DEBUG_PLUGINS=1 in a shell and then running your app. Look through the debug output as your first port of call for whatever is happening.



  • That worked!!! Thank you!


Log in to reply