How do I load qmysql driver in Qt? I have the following code that produces these results:
(\"QSQLITE\", \"QMYSQL\", \"QMYSQL3\")
QSqlDatabase:
Got the same problem and some Google research and intuition finally solved it. Using Qt5.9.1 and Ubuntu 17.10
First, check if the error of libmysqlclient.so.18 => not found is present
:~/Qt5.9.1/5.9.1/gcc_64/plugins/sqldrivers$ ldd libqsqlmysql.so
Second, search where is libmysqlclient
:/$ locate libmysqlclient
Third, go to the folder where libmysqlclient is present and there make the link
:/usr/lib/x86_64-linux-gnu$ sudo ln -s libmysqlclient.so.20 libmysqlclient.so.18
and check the link made before with
ls -alh | grep libmysql
At that moment, none of those solved for me, and i decided to look further in synaptic packages, and realize that libqt5sql5-mysql version 5.9.1 was not installed, so installing it solved the problem but i still have a message when doing ldd
./libqsqlmysql.so: /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18: version `libmysqlclient_18' not found (required by ./libqsqlmysql.so)
after that, found some links that guide me to a real solution, here are them, if you wanna know whats happening
i downloaded the library stated in the third link and worked like a charm. hope it helps!
https://www.unix.com/unix-for-advanced-and-expert-users/107611-difference-between-libsqlclient-so-libsqlclient_r-so.html
http://www.tango-controls.org/community/forum/c/general/installation/ubuntu-1604-problem-installing-from-source-code-libmysqlclient-replaces-libmysqlclient_r/
https://superuser.com/questions/1101426/installing-libmysqlclient18-on-ubuntu-16-04?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa&newreg=9c558283c488461aaf597ef1132e4ca0