qt5应用odbc 使用mysql 要点
apt-get install mysql-server
apt-get install mysqlclient-dev
配置mysql-server
可以安装 apt-get install mysql-workbench
apt-get install mysql -connector-odbc
配置/etc/odbc.ini /etc/odbcinst.ini
apt-get install unixodbc
isql DNS -v 测试是否成功
不成功,检查ldd libmyodbc8w.so libmysqlclient.so是否有缺失的引用so库,缺啥补啥。
ldd libmyodbc8w.so
ldd libmyodbc8w.so
linux-vdso.so.1 (0x00007ffd0233e000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd08c69b000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd08c696000)
libcrypto.so.3 => /usr/lib/./libcrypto.so.3 (0x00007fd08b600000)
libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007fd08c5f2000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fd08bdec000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd08c5eb000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd08bd05000)
libodbcinst.so.2 => /lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007fd08bcf0000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd08b200000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd08bcd0000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd08ae00000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd08c6b9000)
libltdl.so.7 => /lib/x86_64-linux-gnu/libltdl.so.7 (0x00007fd08bcc5000)
ldd libmysqlclient.so
linux-vdso.so.1 (0x00007ffd62925000)
libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007f1a2235c000)
libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007f1a21e00000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f1a22b68000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1a21a00000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1a22b48000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1a21600000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1a22275000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1a22b95000)
获取qt5base-everywhere-opensource源码包,tar 解开
./confiure
用qmake创建Makefile,
odbc/ qmake -o Makefile
odbc/ make 编译
检查上级目录plugins生成libqsqlodbc.so
make install //! cp mv /usr/lib不能注册 ldd检查没有缺少so,就是报driver not found错误
qdb= QSqlDatabase::addDatabase("QODBC");
//qdb =QSqlDatabase::addDatabase("QMYSQL");
qdb.setDatabaseName("mysql_dbox");//DNS name
配置成功.
标签:qt5,x86,lib,gnu,mysql,odbc,64,so.6,linux From: https://www.cnblogs.com/beenbynow/p/17660477.html