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. Problem connecting mysql to my qt application under linux
Forum Updated to NodeBB v4.3 + New Features

Problem connecting mysql to my qt application under linux

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
10 Posts 2 Posters 861 Views
  • 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.
  • A Offline
    A Offline
    Alfredy
    wrote on 28 May 2024, 05:23 last edited by
    #1

    qt.sql.qsqldatabase: QSqlDatabase: QMYSQL driver not loaded

    I'm having trouble connecting my application with my mysql database... I was on windows but I've decided to switch to Linux for good.
    Can you help me? You can find above the error message on the sql driver I have.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 28 May 2024, 05:26 last edited by jsulm
      #2

      This is asked very often, you should use search function.
      Set QT_DEBUG_PLUGINS env variable before starting your app and examine the output of your application and/or post it here.
      See https://doc.qt.io/qt-6/debug.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Alfredy
        wrote on 28 May 2024, 05:53 last edited by
        #3

        Okay, I'll try and get back to you.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Alfredy
          wrote on 28 May 2024, 06:09 last edited by
          #4

          Here is the message I received

          t.sql.qsqldatabase: QSqlDatabase: QMYSQL driver not loaded
          qt.sql.qsqldatabase: QSqlDatabase: available drivers: QMARIADB QMYSQL QSQLITE QODBC QPSQL QMIMER

          J 1 Reply Last reply 28 May 2024, 06:11
          0
          • A Alfredy
            28 May 2024, 06:09

            Here is the message I received

            t.sql.qsqldatabase: QSqlDatabase: QMYSQL driver not loaded
            qt.sql.qsqldatabase: QSqlDatabase: available drivers: QMARIADB QMYSQL QSQLITE QODBC QPSQL QMIMER

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 28 May 2024, 06:11 last edited by
            #5

            @Alfredy said in Problem connecting mysql to my qt application under linux:

            Here is the message I received

            There must be a lot more if you properly set QT_DEBUG_PLUGINS as I advised you.
            Please do so and post the output, else we can only guess what the problem is...

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Alfredy
              wrote on 28 May 2024, 06:24 last edited by
              #6

              Sorry I did it maybe I did it wrong. If you have a concrete orientation other than this link do not hesitate to provide it to me .. For the moment I'm thinking

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Alfredy
                wrote on 28 May 2024, 06:41 last edited by
                #7

                Check this please :
                qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL")
                qt.core.plugin.factoryloader: looking at "qsqlmysql.debug"
                qt.core.plugin.factoryloader: "The shared library was not found."
                not a plugin
                qt.core.plugin.factoryloader: looking at "libqsqlmimer.so"
                qt.core.plugin.loader: Found metadata in lib /home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmimer.so, metadata=
                {
                "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                "MetaData": {
                "Keys": [
                "QMIMER"
                ]
                },
                "archlevel": 1,
                "className": "QMimerSQLDriverPlugin",
                "debug": false,
                "version": 395264
                }

                qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMIMER")
                qt.core.plugin.factoryloader: checking directory path "/home/.../P/MP/NN/App logiciel/gest_/gestion_d/build/Desktop-Release/sqldrivers" ...
                qt.core.library: "/home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so" cannot load: Cannot load library /home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so: libmysqlclient.so.21: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
                qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so" : "Cannot load library /home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so: libmysqlclient.so.21: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type"
                qt.sql.qsqldatabase: QSqlDatabase: QMYSQL driver not loaded
                qt.sql.qsqldatabase: QSqlDatabase: available drivers: QMARIADB QMYSQL QSQLITE QODBC QPSQL QMIMER
                "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqgif.so" unloaded library
                "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqicns.so" unloaded library
                "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqico.so" unloaded library
                "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqjpeg.so" unloaded library
                "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqpdf.so" unloaded library
                "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqsvg.so" unloaded library
                "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqtga.so" unloaded library
                "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqtiff.so" unloaded library
                "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqwbmp.so" unloaded library
                "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqwebp.so" unloaded library
                "/home/.../Qt/6.8.0/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" unloaded library
                "/home/.../Qt/6.8.0/gcc_64/plugins/platforms/libqxcb.so" unloaded library

                J 1 Reply Last reply 28 May 2024, 06:54
                0
                • A Alfredy
                  28 May 2024, 06:41

                  Check this please :
                  qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL")
                  qt.core.plugin.factoryloader: looking at "qsqlmysql.debug"
                  qt.core.plugin.factoryloader: "The shared library was not found."
                  not a plugin
                  qt.core.plugin.factoryloader: looking at "libqsqlmimer.so"
                  qt.core.plugin.loader: Found metadata in lib /home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmimer.so, metadata=
                  {
                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                  "MetaData": {
                  "Keys": [
                  "QMIMER"
                  ]
                  },
                  "archlevel": 1,
                  "className": "QMimerSQLDriverPlugin",
                  "debug": false,
                  "version": 395264
                  }

                  qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMIMER")
                  qt.core.plugin.factoryloader: checking directory path "/home/.../P/MP/NN/App logiciel/gest_/gestion_d/build/Desktop-Release/sqldrivers" ...
                  qt.core.library: "/home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so" cannot load: Cannot load library /home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so: libmysqlclient.so.21: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
                  qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so" : "Cannot load library /home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so: libmysqlclient.so.21: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type"
                  qt.sql.qsqldatabase: QSqlDatabase: QMYSQL driver not loaded
                  qt.sql.qsqldatabase: QSqlDatabase: available drivers: QMARIADB QMYSQL QSQLITE QODBC QPSQL QMIMER
                  "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqgif.so" unloaded library
                  "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqicns.so" unloaded library
                  "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqico.so" unloaded library
                  "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqjpeg.so" unloaded library
                  "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqpdf.so" unloaded library
                  "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqsvg.so" unloaded library
                  "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqtga.so" unloaded library
                  "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqtiff.so" unloaded library
                  "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqwbmp.so" unloaded library
                  "/home/.../Qt/6.8.0/gcc_64/plugins/imageformats/libqwebp.so" unloaded library
                  "/home/.../Qt/6.8.0/gcc_64/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so" unloaded library
                  "/home/.../Qt/6.8.0/gcc_64/plugins/platforms/libqxcb.so" unloaded library

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 28 May 2024, 06:54 last edited by
                  #8

                  @Alfredy said in Problem connecting mysql to my qt application under linux:

                  qt.core.library: "/home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so" cannot load: Cannot load library /home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so: libmysqlclient.so.21: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
                  qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so" : "Cannot load library /home/.../Qt/6.8.0/gcc_64/plugins/sqldrivers/libqsqlmysql.so: libmysqlclient.so.21: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type"

                  This is your problem. The MySQL client library is missing (libmysqlclient.so.21), download and install it.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    Alfredy
                    wrote on 28 May 2024, 06:55 last edited by
                    #9

                    How do I download this? Thanks

                    J 1 Reply Last reply 28 May 2024, 06:59
                    0
                    • A Alfredy
                      28 May 2024, 06:55

                      How do I download this? Thanks

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 28 May 2024, 06:59 last edited by
                      #10

                      @Alfredy said in Problem connecting mysql to my qt application under linux:

                      How do I download this?

                      If you search for "mysql client library" you will find https://dev.mysql.com/downloads/c-api/
                      But it looks like you're on Linux, in that case install the package containing MySQL client library (on Ubuntu it's libmysqlclient21).

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      2

                      1/10

                      28 May 2024, 05:23

                      • Login

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