Ubuntu下Qt连接MySql提示以下错误,暂时未找到解决方法
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
failed to setup db
出现这个问题的原因是Qt中没有MySql driver或者是版本有问题导致的,解决的方法是找到Qt源码重新编译MySql driver的驱动。
官方提供的驱动编译方法:
How to Build the QMYSQL Plugin on Unix and macOS
You need the MySQL header files and as well as the shared library libmysqlclient.so. Depending on your Linux distribution you may need to install a package which is usually called "mysql-devel".
Tell qmake where to find the MySQL header files and shared libraries (here it is assu