QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
I'm struggling for 2 days to figure it out. I did my research trust me. None of those solutions worked for me. When I execute
/Qt5.13.2/5.13.2/gcc_64/plugins/sqldrivers$ ldd libqsqlmysql.so
I get not a dynamic executable. So I guess it's not a good file because when I execute ldd on libqsqlite.so I get
linux-vdso.so.1 (0x00007f80db0f5000)
libQt5Sql.so.5 => /home/bogdan/Qt5.13.2/5.13.2/gcc_64/plugins/sqldrivers/./../../lib/libQt5Sql.so.5 (0x00007f80da96d000)
libQt5Core.so.5 => /home/bogdan/Qt5.13.2/5.13.2/gcc_64/plugins/sqldrivers/./../../lib/libQt5Core.so.5 (0x00007f80da1bd000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f80d9f9e000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f80d9c15000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f80d9877000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f80d965f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f80d926e000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f80d9051000)
libicui18n.so.56 => /home/bogdan/Qt5.13.2/5.13.2/gcc_64/plugins/sqldrivers/./../../lib/libicui18n.so.56 (0x00007f80d8bb8000)
libicuuc.so.56 => /home/bogdan/Qt5.13.2/5.13.2/gcc_64/plugins/sqldrivers/./../../lib/libicuuc.so.56 (0x00007f80d8800000)
libicudata.so.56 => /home/bogdan/Qt5.13.2/5.13.2/gcc_64/plugins/sqldrivers/./../../lib/libicudata.so.56 (0x00007f80d6e1d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f80d6c19000)
libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f80d6a17000)
libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f80d6700000)
/lib64/ld-linux-x86-64.so.2 (0x00007f80daed0000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f80d648e000)
Can someone help me to fix this problem with exact steps.Thanks in advance!
I have reopened the question why the steps in the #peppe answer need to be updated for recent versions of Qt.
Steps:
Install the development versions of the packages found above: libmysqlclient-dev
Run the MaintenanceTool from your Qt installation, and be sure to select to install Qt's source code too, or clone the project using:
git clone -b YOUR_QT_VERSION https://github.com/qt/qtbase.git
or
git clone -b YOUR_QT_VERSION git://code.qt.io/qt/qtbase.git
in this case YOUR_QT_VERSION=5.13.2)
Go in QTDIR/QT_VERSION/Src/qtbase/src/plugins/sqldrivers/
Run the right qmake, i.e. the one coming from that installation of Qt (not the system wide one or similar). Best way to be sure is providing the full path to it: QTDIR/QT_VERSION/gcc_64/bin/qmake sqldrivers.pro
Run make && make install
Related
I try to use the MySQL module from QT but without result, the module is present but Qt does not load it. I have this error
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
QSqlError("", "Driver not loaded", "Driver not loaded")
if I make a ldd libqsqlmysql.so I get this result
linux-vdso.so.1 (0x00007ffe89950000)
libmysqlclient_r.so.16 => not found
libQt5Sql.so.5 => /opt/Qt/5.4/gcc_64/plugins/sqldrivers/./../../lib/libQt5Sql.so.5 (0x00007fdc67aaf000)
libQt5Core.so.5 => /opt/Qt/5.4/gcc_64/plugins/sqldrivers/./../../lib/libQt5Core.so.5 (0x00007fdc67372000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fdc6706b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdc66cc2000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fdc66aa4000)
libicui18n.so.53 => /opt/Qt/5.4/gcc_64/plugins/sqldrivers/./../../lib/libicui18n.so.53 (0x00007fdc66658000)
libicuuc.so.53 => /opt/Qt/5.4/gcc_64/plugins/sqldrivers/./../../lib/libicuuc.so.53 (0x00007fdc662cd000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fdc660c8000)
libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fdc65ec6000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fdc65cbe000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fdc659c5000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fdc656c4000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fdc654ae000)
/lib64/ld-linux-x86-64.so.2 (0x00007fdc67f1c000)
libicudata.so.53 => /opt/Qt/5.4/gcc_64/plugins/sqldrivers/./../../lib/libicudata.so.53 (0x00007fdc63e25000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fdc63be8000)
the problem is I think this line libmysqlclient_r.so.16 => not found
If I make a locate mysqlclient I get this reuslt
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18.0.0
/usr/share/doc/libmysqlclient18
/usr/share/doc/libmysqlclient18/NEWS.Debian.gz
/usr/share/doc/libmysqlclient18/changelog.Debian.gz
/usr/share/doc/libmysqlclient18/changelog.gz
/usr/share/doc/libmysqlclient18/copyright
/var/cache/apt/archives/libmysqlclient18_5.5.43-0+deb7u1_amd64.deb
/var/cache/apt/archives/libmysqlclient18_5.5.44-0+deb7u1_amd64.deb
/var/lib/dpkg/info/libmysqlclient18:amd64.list
/var/lib/dpkg/info/libmysqlclient18:amd64.md5sums
/var/lib/dpkg/info/libmysqlclient18:amd64.postinst
/var/lib/dpkg/info/libmysqlclient18:amd64.postrm
/var/lib/dpkg/info/libmysqlclient18:amd64.shlibs
I read about some forum, the need to make a symbolic link I tried but I always this error
Assuming that for getting this error you installed Qt from the binary packages downloaded from qt.io:
Install the MySQL client dev packages
Run the MaintenanceTool (somewhere where you installed Qt)
Ask it to install extra packages
Install the "Source Components" for at least the Essential modules
Go to /dir/where/you/installed/Qt/version/Source/
Go into qtbase/src/plugins/sqldrivers/mysql
Run qmake from the very same Qt version (/dir/where/you/installed/Qt/version/arch/bin/qmake or similar)
Run make, if it explodes with headers/libraries not found check that you installed those MySQL client dev packages correctly
That should give you a brand new plugin, and with fingers crossed, it's already put in the right place. Otherwise find the new libqsqlmysql.so, ldd it to be sure it was OK, and overwrite the old plugin with the new one.
I finally found a solution to my problem, so I have download libmysqlclient16 from libmysqlclient16 Debian amd64
After I made dpkg -i libmysqlclient16_5.1.73-1_amd64.deb
I restart and I compile my Qt project and I could not error
I know it is an old question, but I had the same issue with a slightly different solution probably due to Qt updates since then.
I will provide the solution that worked for me running Fedora 26 with kernel 4.13 and Qt 5.9.1
Find your path to Qt installation and let's call it here QTDIR.
In my case it is installed at /home/Qt5. So QTDIR = /home/Qt5/
My version is 5.9.1. Therefore I also have a folder "5.9.1" in QTDIR and I will call it "version" folder as Pepe did above.
The last folder that depends on your installation is the compiler folder. In my case it is gcc_64 inside QTDIR/version/
Now that you located yourself, let's go the procedure to install the drivers for Qt.
1) If your linux distribution doesn't come with SQL headers installed you must install them first. In Fedora I istalled the community-mysql-devel
> sudo dnf install community-mysql-devel
You must search and the install the appropriate SQL package for your distro. Just remember that the main idea is to install some development package in order to access the headers.
2) The second thing you need to do is to make sure you had installed Qt with the sources directory.
Check if you have the foulder $QTDIR/version/Src. If you have not, then run the maintenance tool in QTDIR and add Src foulder by checking the "sources" option under the kit you had installed (or wish to install).
3) Then go to where the sqldrivers should be by typing in your terminal
> cd yourQTDIR/yourVersion/Src/qtbase/src/plugins/sqldrivers
and run on terminal:
> make
> make install
This should create the drivers libqsqlite.so and libqsqlmysql.so in the folder: yourQTDIR/yourVersion/yourCompiler/plugins/sqldrivers
We then move to update a path to the sql headers as described in the official site http://doc.qt.io/qt-5/sql-driver.html, but with a slightly difference in the path to mysql headers (you must verify the proper folders in your OS). In my case MYSQL headers are in /usr/lib64.
Go to
> cd yourQTDIR/yourVersion/Src/qtbase/src/plugins/sqldrivers/mysql
Then run
> yourQTDIR/yourVersion/yourCompilerFolder/bin/qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib64 -lmysqlclient_r" mysql.pro
> make
> make install
This should do the trick.
4) Now go to "yourQTDIR"/"yourVersion"/"yourCompiler"/plugins/sqldrivers
and run
> ldd libqsqlmysql.so
This will allow you to check if there is any missing link and direct you to a more specific solution to your case.
In a couple of Qt versions from now the procedure above may change. However the main points to keep in mind are that 1) you must have the MYSQL headers installed; 2) you must create the plugin by running make and make install in some source folder for MYQSL, and 3) you must update the path to MYSQL headers in order to Qt to find it.
I'm trying to link MySQL with a different glibc that provides e.g. a different pthread implementation and actually thought I got it right a few days ago.
Obviously, I took notes and wanted to reproduce the outcome but I can't get it to link properly, so I must have forgotten a step.
What I did previously was simply to add the flags pointing to my glibc and the default one second to the cmake command.
GLIBC_FLAGS="-Wl,--rpath=/path/to/my/glibc/build/lib:/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu -Wl,--dynamic-linker=/path/to/my/glibc/build/lib/ld-linux-x86-64.so.2
cmake \
-DCMAKE_INSTALL_PREFIX=../install \
.. \
-DCMAKE_C_FLAGS="$GLIBC_FLAGS" \
-DCMAKE_CXX_FLAGS="$GLIBC_FLAGS"
These flags work when building a simple a test-program but seem not to work with MySQL as ldd reports the default glibc for mysqld.
$ ldd install/bin/mysqld
linux-vdso.so.1 => (0x00007fff14ffe000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f4f1c9bb000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4f1c7b7000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4f1c599000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f4f1c295000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4f1bf91000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4f1bd7a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4f1b9b2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4f1cc13000)
I also tried to set the LD_LIBRARY_PATH and changing the linker flags and lib variables in BUILD/scripts/mysql_config but none of these seem to work.
What is necessary to link MySQL against a different glibc?
ldd reports the default glibc for mysqld.
You should not trust ldd -- it uses default loader -- /lib64/ld-linux-x86-64.so.2 which is not the loader you've compiled your musqld to use.
Instead, run your mysqld under GDB and do start followed by info shared. You will likely see that in fact your version of glibc is actually loaded.
After a Kernel-Update, cmake apparently ignored the DCMAKE_CXX_FLAGS and DCMAKE_C_FLAGS if they contained a colon-separated list of paths (the options were used when they contained only a single path).
I worked around this by setting the colon-separated pathlist directly in the CMakeLists.txt in the MySQL root directory.
(Sorry for my bad english)
My config : Debian 7 / Qt 5
I have a mad problem :
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
So i have do lot of search, but i can't find the bug.
More informations :
$ ldd myProg
...
libmysqlclient.so.18 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 (0x00007f0e9f06f000)
$ ldd /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
linux-vdso.so.1 (0x00007fff67dff000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0033680000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f0033469000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0033264000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f003305c000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f0032d55000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0032a56000)
In my myProg.pro, i inform LIBS += -lmysqlclient_r
Somebody know this problem ?
Have a good day :)
The problem is that Qt try to load QMYSQL not MySQL.
QMYSQL is provided by Qt (it look like you haven't it.)
As you are French take a look at that: http://fr.openclassrooms.com/forum/sujet/qt-et-qmysql-69955
For non-French users google 'QMYSQL Qt' on google you will find a way to install it.
(This is a cross-post from ask.puppetlabs.com)
I am setting up a centos6.4 VM using Vagrant and Puppet. First off, my familiarity is with Debian linux and also I am new to Puppet, so sorry if I am missing something basic...
I am using the mysql module from puppetlabs, and the default version of mysql installed is 5.1 but I'd like to install 5.5.
From this post, it looks like I need to grab mysql5.5 from some extra repos,
My Puppetfile looks like:
forge "http://forge.puppetlabs.com"
mod 'puppetlabs/stdlib'
mod 'puppetlabs/apache'
mod 'puppetlabs/mysql'
I added a yumrepo declaration
yumrepo {
'epel':
descr => 'Extra Packages for Enterprise Linux 6 - $basearch',
enabled => "1",
gpgcheck => "1",
failovermethod => 'priority',
gpgkey => "http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm",
;
'remi':
descr => 'Extra Packages for Enterprise Linux 6 - $basearch',
enabled => "1",
gpgcheck => "1",
failovermethod => 'priority',
gpgkey => "http://rpms.famillecollet.com/enterprise/remi-release-6.rpm",
;
}
If I add package_ensure with the targeted version,
class { '::mysql::server':
package_ensure => "5.5.36-1.el6.remi",
}
I can see that puppet tries to install that package, but mysql5.1 has already been installed by that point and there are dependencies that conflict. I've tried searching for a good approach, but am not familiar enough with puppet yet to know what to look for.
Thanks for the help
first to install mysql 5.5 you have remove mysql 5.1 add the following lines init.pp and moreover epel repo will not not install 5.5 on your system you need to install it with rpm of mysql to install it with rpm use add the following lines in int.pp file
package { 'mysql-libs':
ensure => 'purged',
}
package { 'MySQL-server-5.5.8-1.rhel5.x86_64':
provider => 'rpm',
ensure => installed,
source => "/path_to_dir/MySQL-server-5.5.8-1.rhel5.x86_64.rpm",
require => Package['mysql-libs'],
}
I have downloaded the libmongoc driver from git repo and make install it. and then I downloaded the collectd tar file, and extract it and try to install it, every thing went ok, but when I try to run collect d I face these error :
[path to collectd]# sbin/collectd
ERROR: lt_dlopen ("/opt/collectd/lib/collectd/write_mongodb.so") failed: file not found.
The most common cause for this problem are missing dependencies.
Use ldd(1) to check the dependencies of the plugin / shared object.
[path to collectd]#
[path to collectd]# ldd /opt/collectd/lib/collectd/write_mongodb.so
linux-vdso.so.1 => (0x00007fff1dbaa000)
libmongoc.so.0.7 => not found
libdl.so.2 => /lib64/libdl.so.2 (0x00007f8351fd1000)
libc.so.6 => /lib64/libc.so.6 (0x00007f8351c1a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f83523e4000)
[path to collectd]#
[path to collectd]# locate libmongoc.so.0.7
/usr/local/lib/libmongoc.so.0.7
/usr/local/lib/libmongoc.so.0.7.1
[path to collectd]#
why collectd does not recognize the installed libmongoc library?
i successfuly installed collectd with write_mongodb.
[root#stackdev ~]# ldd /usr/local/etc/collectd/lib/collectd/write_mongodb.so
linux-vdso.so.1 => (0x00007fffa3ffe000)
libmongoc.so.0.6 => not found
libdl.so.2 => /lib64/libdl.so.2 (0x00007f1134fe8000)
libc.so.6 => /lib64/libc.so.6 (0x00007f1134c2f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1135614000)
and then i copied libmongoc.so.0.6 (i installed it at /usr/local/lib
) into directory of /lib64
and then run collectd ,all works fine.
Hope this can help you.