Using QT to connect MySQL needs to share the driver of the library libqsqlmysql.so, the path in the Plugin/sqldrivers directory, at first glance is available, not actually.
With ldd command analysis, libmysqlclient_r.so.16 = not found, after obvious libmysqlclient_r.so.16 missing another shared library, they are dependencies, Solved the problem that QT can really connect to the MySQL database. And my/usr/lib64/under the version of the shared library is libmysqlclient.so.18, think of a more speculative idea ln creates symbolic links, however, there is no egg to use.
Let me laugh and cry is QT5.5 is I download from the official website, incredibly rely on is the low version, you compile the time can not lazy ah, estimated they directly from the lower version copy of the libqsqlmysql.so, no way? Obviously not, open the QT official website to download the source code, compiles itself. Download process skipped, very easy to find http://download.qt.io/official_releases/qt/5.4/5.4.2/submodules/(temporarily no qt5.5 source), found qtbase that about 60M. The path to the MySQL drive is qtbase/src/plugins/sqldrivers/mysql/.
However, this is not yet complete, and the dynamic library is not found in the make process:
/usr/bin/ldFind -LZ/usr/bin/ldFind -lssl/usr/bin/ld Find -lcrypto
The first one is not installed Zlib-devel, direct yum install zlib-devel fix.
The second third item cannot be found to be unreasonable, workaround: Create Symbolic links in/usr/lib64/
Ln -S libssl.so. 1.0 . 1e Libssl.so Ln -S libcrypto.so. 1.0. 1e libcrypto.so
Make again, success. Of course this is not finished, with the new libqsqlmysql.so to replace the old, this is all done.
Check again:
[sqldrivers]ldd libqsqlmysql.so linux-vdso.so.1= (0x00007fff2d5fe000) libmysqlclient.so. -= =/usr/lib64/mysql/libmysqlclient.so. -(0x00007feb4ea24000) libz.so.1= =/lib64/libz.so.1(0x00007feb4e80d000) libcrypt.so.1= =/lib64/libcrypt.so.1(0x00007feb4e5d6000) libnsl.so.1= =/lib64/libnsl.so.1(0x00007feb4e3bd000) libssl.so.Ten= =/lib64/libssl.so.Ten(0x00007feb4e150000) libcrypto.so.Ten= =/lib64/libcrypto.so.Ten(0x00007feb4dd6b000) libqt5sql.so.5= =/home/eric/qt5.5.0/5.5/gcc_64/lib/libqt5sql.so.5(0x00007feb4db2b000) libqt5core.so.5= =/home/eric/qt5.5.0/5.5/gcc_64/lib/libqt5core.so.5(0x00007feb4d3e3000) libpthread.so.0= =/lib64/libpthread.so.0(0x00007feb4d1c7000) Libstdc++.so.6= =/lib64/libstdc++.so.6(0x00007feb4cec0000) libm.so.6= =/lib64/libm.so.6(0x00007feb4cbbd000) libgcc_s.so.1= =/lib64/libgcc_s.so.1(0x00007feb4c9a7000) libc.so.6= =/lib64/libc.so.6(0x00007feb4c5e6000) libdl.so.2= =/lib64/libdl.so.2(0x00007feb4c3e1000) libfreebl3.so=/lib64/libfreebl3.so (0x00007feb4c164000) libgssapi_krb5.so.2= =/lib64/libgssapi_krb5.so.2(0x00007feb4bf1a000) libkrb5.so.3= =/lib64/libkrb5.so.3(0x00007feb4bc39000) libcom_err.so.2= =/lib64/libcom_err.so.2(0x00007feb4ba35000) libk5crypto.so.3= =/lib64/libk5crypto.so.3(0x00007feb4b800000) libicui18n.so. Wu= =/home/eric/qt5.5.0/5.5/gcc_64/lib/libicui18n.so. Wu(0x00007feb4b391000) libicuuc.so. Wu= =/home/eric/qt5.5.0/5.5/gcc_64/lib/libicuuc.so. Wu(0x00007feb4afe3000) libicudata.so. Wu= =/home/eric/qt5.5.0/5.5/gcc_64/lib/libicudata.so. Wu(0x00007feb495b9000) Libgthread-2.0. So.0=/lib64/libgthread-2.0. So.0(0x00007feb493b6000) librt.so.1= =/lib64/librt.so.1(0x00007feb491ae000) Libglib-2.0. So.0=/lib64/libglib-2.0. So.0(0x00007feb48e85000) /lib64/LD-linux-x86- -. So.2(0x00007feb4f221000) libkrb5support.so.0= =/lib64/libkrb5support.so.0(0x00007feb48c76000) libkeyutils.so.1= =/lib64/libkeyutils.so.1(0x00007feb48a72000) libresolv.so.2= =/lib64/libresolv.so.2(0x00007feb48858000) libselinux.so.1= =/lib64/libselinux.so.1(0x00007feb48632000) libpcre.so.1= =/lib64/libpcre.so.1(0x00007feb483d1000) liblzma.so.5= =/lib64/liblzma.so.5(0x00007feb481ab000)
CentOS7 (64-bit) QT5.5 connection to MySQL database (driver not loaded)