Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QMYSQL driver not loaded on Ubuntu
Forum Updated to NodeBB v4.3 + New Features

QMYSQL driver not loaded on Ubuntu

Scheduled Pinned Locked Moved Solved Installation and Deployment
61 Posts 5 Posters 80.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #38

    [quote author="SGaist" date="1389256104"]Did you retry to run qmake now ?[/quote]

    Ok...

    Yes... please see again an error:

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #39

      Since you installed Qt 5.2 Why didn't you use the qmake from that Qt rather than the one from the system ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #40

        Well , I want to build mysql plugin for Qt 5.2 !
        I get error message : QMySQL driver not found loaded.

        I try test with a minimal code :

        Main :

        @
        #include <QCoreApplication>
        #include <QtSql/QSqlDatabase>
        #include <QtSql>
        #include <QDebug>

        //remplacer l'affichage par la commande cout
        #define q2c(string) string.toStdString()

        int main(int argc, char *argv[])
        {
        QCoreApplication a(argc, argv);

        QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
           db.setHostName("localhost");
           db.setDatabaseName("qtdatabase");
           db.setUserName("root");
           db.setPassword("");
           bool ok = db.open();
        
        return a.exec&#40;&#41;;
        

        }

        @

        and .pro :

        @
        #-------------------------------------------------

        Project created by QtCreator 2014-01-01T09:22:46

        #-------------------------------------------------

        QT += core
        QT += sql
        QT -= gui

        TARGET = untitled18
        CONFIG += console
        CONFIG -= app_bundle

        QTPLUGIN += qsqlmysql
        TEMPLATE = app

        SOURCES += main.cpp

        @

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #41

          Then use /opt/Qt5.2.0/path_to_bin/qmake to configure the plugin project

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #42

            [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 :)

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #43

              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

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #44

                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.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #45

                  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
                  @

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #46

                    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 project

                    Mode:
                    -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 directory

                    Warnings 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]
                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #47

                      remove -lmysqlclient_r

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #48

                        Yes , Solved !
                        Thank you dear :)

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #49

                          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 :)

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            Malhar
                            wrote on last edited by
                            #50

                            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.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #51

                              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.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              M 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                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.

                                M Offline
                                M Offline
                                Malhar
                                wrote on last edited by
                                #52

                                @SGaist ok. Once i faced this problem and i solved installing dependency of .so file.
                                Now what should i do then.

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #53

                                  How did you install Qt ?

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    Malhar
                                    wrote on last edited by
                                    #54

                                    using wget command "http://download.qt.io/archive/qt/5.1/5.1.0/qt-linux-opensource-5.1.0-x86_64-offline.run"

                                    1 Reply Last reply
                                    0
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #55

                                      You're aware that the current version is 5.5.1, aren't you ?

                                      Interested in AI ? www.idiap.ch
                                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        Malhar
                                        wrote on last edited by
                                        #56

                                        yes i know about the latest version but my whole development is done on Qt5.1 so i dont want to change the version.

                                        1 Reply Last reply
                                        0
                                        • SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #57

                                          Then you might have to build the plugin yourself.

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved