QMYSQL driver not loaded on Ubuntu
-
Then use /opt/Qt5.2.0/path_to_bin/qmake to configure the plugin project
-
wrote on 9 Jan 2014, 09:47 last edited by
[quote author="SGaist" date="1389260673"]Then use /opt/Qt5.2.0/path_to_bin/qmake to configure the plugin project[/quote]
I don't understand can you give me true and full command ? please :)
-
rather that calling just qmake like you already did in the plugin folder, use the full path to /opt/Qt5.2.0/whatever_is_needed/bin/qmake and you should be good
-
wrote on 9 Jan 2014, 14:58 last edited by
I have this path /opt/Qt5.2.0/5.2.0/gcc_64/bin/(qmake)
root@Gigabyte-Z68P-DS3:/opt/Qt5.2.0/5.2.0/Src/qtbase/src/plugins/sqldrivers/mysql# qmake "INCLUDEPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
Project ERROR: addExclusiveBuilds() requires at least two arguments
I think my path is not true :( In Qt 4 i can build but in Qt 5.2 anything is different.
-
use the full path:
@
root@Gigabyte-Z68P-DS3:/opt/Qt5.2.0/5.2.0/Src/qtbase/src/plugins/sqldrivers/mysql# /opt/Qt5.2.0/5.2.0/gcc_64/bin/qmake “INCLUDEPATH+=/usr/include/mysql” “LIBS+=-L/usr/lib/mysql -lmysqlclient_r” mysql.pro
@ -
wrote on 10 Jan 2014, 08:49 last edited by
Sorry but gives follow message :
root@Gigabyte-Z68P-DS3:/opt/Qt5.2.0/5.2.0/Src/qtbase/src/plugins/sqldrivers/mysql# /opt/Qt5.2.0/5.2.0/gcc_64/bin/qmake “INCLUDEPATH+=/usr/include/mysql” “LIBS+=-L/usr/lib/mysql -lmysqlclient_r” mysql.pro
***Unknown option -lmysqlclient_r”
Usage: /opt/Qt5.2.0/5.2.0/gcc_64/bin/qmake [mode] [options] [files]QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing projectMode:
-project Put qmake into project file generation mode
In this mode qmake interprets files as files to
be built,
defaults to *; *; *; *.ts; *.xlf; *.qrc
Note: The created .pro file probably will
need to be edited. For example add the QT variable to
specify what modules are required.
-makefile Put qmake into makefile generation mode (default)
In this mode qmake interprets files as project files to
be processed, if skipped qmake will try to find a project
file in your current working directoryWarnings Options:
-Wnone Turn off all warnings; specific ones may be re-enabled by
later -W options
-Wall Turn on all warnings
-Wparser Turn on parser warnings
-Wlogic Turn on logic warnings (on by default)
-Wdeprecated Turn on deprecation warnings (on by default)Options:
- You can place any variable assignment in options and it will be *
- processed as if it was in [files]. These assignments will be parsed *
- before [files]. *
-o file Write output to file
-d Increase debug level
-t templ Overrides TEMPLATE as templ
-tp prefix Overrides TEMPLATE so that prefix is prefixed into the value
-help This help
-v Version information
-after All variable assignments after this will be
parsed after [files]
-norecursive Don't do a recursive search
-recursive Do a recursive search
-set <prop> <value> Set persistent property
-unset <prop> Unset persistent property
-query <prop> Query persistent property. Show all if <prop> is empty.
-cache file Use file as cache [makefile mode only]
-spec spec Use spec as QMAKESPEC [makefile mode only]
-nocache Don't use a cache file [makefile mode only]
-nodepend Don't generate dependencies [makefile mode only]
-nomoc Don't generate moc targets [makefile mode only]
-nopwd Don't look for files in pwd [project mode only]
-
remove -lmysqlclient_r
-
wrote on 10 Jan 2014, 15:21 last edited by
Yes , Solved !
Thank you dear :) -
You're welcome !
Now that you have the plugin, can you please update the thread title prepending [solved] so other forum users may know a solution has been found :)
-
wrote on 30 Oct 2015, 14:31 last edited by
Hi SGaist,
i too faced this error and i did ldd libmysqlclient_r.so.16 and installed the dependency but still m getting this error QMYSQL driver not found available drivers QSQLITE. -
libmysqlclient_r.so.16 is the MySQL client library. What you should test is the Qt driver plugin. But based on available driver list, you don't have the MySQL plugin.
-
libmysqlclient_r.so.16 is the MySQL client library. What you should test is the Qt driver plugin. But based on available driver list, you don't have the MySQL plugin.
-
How did you install Qt ?
-
wrote on 2 Nov 2015, 08:36 last edited by
-
You're aware that the current version is 5.5.1, aren't you ?
-
wrote on 2 Nov 2015, 09:27 last edited by
yes i know about the latest version but my whole development is done on Qt5.1 so i dont want to change the version.
-
Then you might have to build the plugin yourself.
-
wrote on 7 Dec 2016, 10:17 last edited by ram1111 12 Jul 2016, 10:28
Hello SGaist i'm a beginner to Qt.
i get and installed Qt 5.7 in x64 edition for ubuntu.
I have QTPLUGIN += qsqlmysql and QT += sql in file .prowhen i try connect QMYSQL i got Error like :-
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
QSqlError("", "Driver not loaded", "Driver not loaded")when i do
itas02@itas02:/opt/Qt5.7.0/5.7/gcc_64/plugins/sqldrivers$ ldd libqsqlmysql.so
i got this
itas02@itas02:/opt/Qt5.7.0/5.7/gcc_64/plugins/sqldrivers$ ldd libqsqlmysql.so
linux-vdso.so.1 => (0x00007fff17fa3000)
libmysqlclient_r.so.16 => not found
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f379c377000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f379c13e000)
how to get libmysqlclient_r.so ?when i try to build qmake
by
$:/src/plugins/sqldrivers/mysql# /home/../Qt5.7/5.7/gcc_64/bin/qmake “INCLUDEPATH+=/usr/include/mysql” “LIBS+=-L/usr/lib/mysql” mysql.pro
after entering make commandi'm getting like this
g++ -c -pipe -O2 -std=gnu++11 -fvisibility=hidden -fvisibility-inlines-hidden -D_REENTRANT -Wall -W -fPIC -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I/opt/Qt5.7.0/5.7/gcc_64/include -I/opt/Qt5.7.0/5.7/gcc_64/include/QtSql -I/opt/Qt5.7.0/5.7/gcc_64/include/QtCore -I. -I/opt/Qt5.7.0/5.7/gcc_64/mkspecs/linux-g++ -o main.o main.cpp
In file included from main.cpp:44:0:
../../../sql/drivers/mysql/qsql_mysql.h:52:19: fatal error: mysql.h: No such file or directory
#include <mysql.h>
^
compilation terminated.
make: *** [main.o] Error 1i have a mysql.h in /usr/include/mysql/
please let me know where i'm doing mistake are i missing any step.
thanks in advance -
How did you install the MySQL development package ?
And why are you using two different version of Qt ? You are inspecting one in /opt/ and you seem to be calling qmake from another install of Qt in your home folder.
-
wrote on 12 Aug 2017, 11:44 last edited by
Can someone help me here please...
i ran
qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" mysql.pro
And i got these error:
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
What should i do?..