报错信息
19:50:42.751: QSqlDatabase: QMYSQL driver not loaded 19:50:42.751: QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7 19:50:42.751: open fail "Driver not loaded" 19:50:42.752: HTTP server listen: true 19:50:42.752: HTTP server2 listen: true 19:50:42.752: HTTP server3 listen: true 19:50:42.752: QSqlDatabase: QMYSQL driver not loaded 19:50:42.752: QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7 19:50:42.752: open fail "Driver not loaded" 19:50:42.752: All Down
报错截图
解决方法
发现,Qt缺少一个动态链接库,从官网下载一个libmysqlclient.so.18:
https://launchpad.net/ubuntu/xenial/amd64/libmysqlclient18/5.6.25-0ubuntu1
下载完成之后,cd到文件目录,进行安装
sudo dpkg -i libmysqlclient18_5.6.25-0ubuntu1_amd64.deb
再次编译运行项目,成功加载mysql引擎,没有出现相关报错。