打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
QSqlDatabase: QMYSQL driver not loaded but available

QSqlDatabase: QMYSQL driver not loaded but available

Yeah hello there, I'm really new here.
So here's the problem.
Qt Code:
  1. QSqlDatabase: QMYSQL driver not loaded
  2. QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
To copy to clipboard, switch view to plain text mode 
I've checked many forums already and have done things so far:
1) This is my .pro file
Qt Code:
  1. QT += core
  2. QT += sql
  3. QT -= gui

  4. TARGET = DB
  5. CONFIG += console
  6. CONFIG -= app_bundle

  7. QTPLUGIN += QSQLMYSQL
  8. TEMPLATE = app


  9. SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode 

2) This is my sqldrivers folder:
Qt Code:
  1. alex@alex-Laptop:~/Programming/Qt/5.1.0/gcc_64/plugins/sqldrivers$ ls
  2. libqsqlite.so libqsqlmysql.so libqsqlpsql.so
To copy to clipboard, switch view to plain text mode 

3) Have also copied sqldrivers folder to project folder.

Non of these helped an error still exists.
I have read almost everything about my problem but nothing helped.
Please help newbie with the fix.

Thanks in advance





I'm reviving this thread as it seems to be inactive without a answer to the problem and I was dealing with exactly the same problem for the past few days.
(with Opensuse 12.3, x86_64).

it seems that the compiled plugin that comes with the qt (qt-linux-opensource-5.1.0-x86_64-offline.bin) requires /usr/lib64/libmysqlclient_r.so.16 and opensuse comes with .18. So
doing
/usr/lib64 # ln -s libmysqlclient_r.so libmysqlclient_r.so.16

seems to solve the problem.

regards,


使用qt mysqlsql驱动模块出错,原来是libqsqlmysql.so 依赖 libmysqlclient16,而我机上的是libmysqlclient18,所以总是出问题,以后遇到这问题首先要解决的是库依赖的问题
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
Qt5.4.1和MySQL的环境搭建
QT里使用sqlite的问题,好多坑
Qt数据库编程
QT中连接数据库
深入了解 ORM 和 Qt
QT-2 连接mssql
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服