A
A
acra2015-08-14 12:13:05
MySQL
acra, 2015-08-14 12:13:05

How to connect Qt to MySQL server on Ubuntu?

Given: Ubuntu 14.04 32bit ; Qt 5.5 ;
I'm trying to connect to a MySQL database from Qt, everything works on another system. Writes the following errors:

QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7

MySQL client installed.
Tried to build libqsqlmysql.so swears:
make: *** [../../../../plugins/sqldrivers/libqsqlmysql.so] Ошибка 1

On command ~/Qt5.5.0/5.5/gcc/plugins/sqldrivers$ ldd libqsqlmysql.so outputs:
linux-gate.so.1 =>  (0xb76e1000)
libmysqlclient_r.so.16 => /usr/lib/libmysqlclient_r.so.16 (0xb74d2000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb74bc000)
libcrypt.so.1 => /lib/i386-linux-gnu/libcrypt.so.1 (0xb748a000)
libnsl.so.1 => /lib/i386-linux-gnu/libnsl.so.1 (0xb7470000)
libssl.so.10 => not found
libcrypto.so.10 => not found
libQt5Sql.so.5 => /home/maxim/Qt5.5.0/5.5/gcc/plugins/sqldrivers/./../../lib/libQt5Sql.so.5 (0xb7428000)
libQt5Core.so.5 => /home/maxim/Qt5.5.0/5.5/gcc/plugins/sqldrivers/./../../lib/libQt5Core.so.5 (0xb6ede000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb6ec3000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb6dde000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb6db2000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6d94000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb6be8000)
libicui18n.so.54 => /home/maxim/Qt5.5.0/5.5/gcc/plugins/sqldrivers/./../../lib/libicui18n.so.54 (0xb696f000)
libicuuc.so.54 => /home/maxim/Qt5.5.0/5.5/gcc/plugins/sqldrivers/./../../lib/libicuuc.so.54 (0xb67c7000)
libicudata.so.54 => /home/maxim/Qt5.5.0/5.5/gcc/plugins/sqldrivers/./../../lib/libicudata.so.54 (0xb4f9c000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb4f97000)
libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 (0xb4f93000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb4f8a000)
libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb4e91000)
/lib/ld-linux.so.2 (0xb76e2000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb4e55000)

I used to write libmysqlclient_r.so.16 => not found , fixed it like this: wget
launchpadlibrarian.net/75949497/libmysqlclient16_5 ...
sudo dpkg -i ./libmysqlclient16_5.1.58-1ubuntu1_i386.deb
for a hint.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Ergil Osin, 2015-08-14
@Ernillew

If you breed a zoo in the system from libmuscle delivered by dpkg directly, and not by apt and their own compiled from source, then do not be surprised.
Clean the system of debris and put it on a regular basis.

S
Sergei Borisov, 2015-08-14
@risik

Standard lib installation:
sudo apt-get install libmysqlclient-dev

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question