Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. I need to connect MySQL with Qt
Forum Updated to NodeBB v4.3 + New Features

I need to connect MySQL with Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 4 Posters 782 Views 1 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.
  • T Offline
    T Offline
    Tuanhoc8
    wrote on last edited by
    #1

    Hello Everyone. In the past i have a project with connect MySQL with Qt in year 2023. But Now when i used the old code again. It can't not connect I Can't Understand. Please help me.
    The QMYSQL in the List ? I can't understand why
    0d56ad06-2b82-4c48-b551-21254a318df6-image.png

    cfbab6bd-170c-42f0-a57d-e00c58d62ffb-image.png

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Start your app with QT_DEBUG_PLUGINS to see why the mysql driver is no loaded.

      And please don't post screenshots but text.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      T 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        Start your app with QT_DEBUG_PLUGINS to see why the mysql driver is no loaded.

        And please don't post screenshots but text.

        T Offline
        T Offline
        Tuanhoc8
        wrote on last edited by
        #3

        @Christian-Ehrlicher How to use QT_DEBUG_PLUGINS. I don;t know how to use it

        SGaistS 1 Reply Last reply
        0
        • T Tuanhoc8

          @Christian-Ehrlicher How to use QT_DEBUG_PLUGINS. I don;t know how to use it

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Tuanhoc8 it's an environment variable as is explained in the documentation. Set it in the Run part of the Project panel.

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

          T 1 Reply Last reply
          0
          • SGaistS SGaist

            @Tuanhoc8 it's an environment variable as is explained in the documentation. Set it in the Run part of the Project panel.

            T Offline
            T Offline
            Tuanhoc8
            wrote on last edited by
            #5

            @SGaist , It means I go to the Project part in Enviroment in "Run" add the QT_DEBUG_PLUGINS with values is 1? I did it but i Can't see any thing

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

              When you start your application you should see a truck load of debugging messages.

              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
              • T Offline
                T Offline
                Tuanhoc8
                wrote on last edited by
                #7

                @SGaist it display
                `C:\Qt\5.15.2\mingw81_64\plugins\sqldrivers\qsqlmysql.dll': Shared library architecture i386 is not compatible with target architecture i386:x86-64.
                It means i need to use mingw32 ? Is it right

                C 1 Reply Last reply
                0
                • T Tuanhoc8

                  @SGaist it display
                  `C:\Qt\5.15.2\mingw81_64\plugins\sqldrivers\qsqlmysql.dll': Shared library architecture i386 is not compatible with target architecture i386:x86-64.
                  It means i need to use mingw32 ? Is it right

                  C Offline
                  C Offline
                  ChrisW67
                  wrote on last edited by
                  #8

                  Your Mysql plugin should be built with the same compiler (or binary compatible) as the Qt libraries you are using. You are building your application with 64-bit Qt MingW libraries so your Qt Mysql plugin should also be a 64-bit MingW DLL. That looks to be the case.

                  The Mysql runtime library that the Qt plugin loads must also be a 64-bit build. My money is on the Mysql runtime being 32-bit. It is possible you have more than one of these installed and the program is finding the 32-bit version first.

                  T 1 Reply Last reply
                  2
                  • C ChrisW67

                    Your Mysql plugin should be built with the same compiler (or binary compatible) as the Qt libraries you are using. You are building your application with 64-bit Qt MingW libraries so your Qt Mysql plugin should also be a 64-bit MingW DLL. That looks to be the case.

                    The Mysql runtime library that the Qt plugin loads must also be a 64-bit build. My money is on the Mysql runtime being 32-bit. It is possible you have more than one of these installed and the program is finding the 32-bit version first.

                    T Offline
                    T Offline
                    Tuanhoc8
                    wrote on last edited by
                    #9

                    @ChrisW67 So in MySQL i need to download and installer the connector C++ 64 bit ?

                    Christian EhrlicherC 1 Reply Last reply
                    0
                    • T Tuanhoc8

                      @ChrisW67 So in MySQL i need to download and installer the connector C++ 64 bit ?

                      Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @Tuanhoc8 if you want to use the 64bit plugin, yes.

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      T 1 Reply Last reply
                      0
                      • Christian EhrlicherC Christian Ehrlicher

                        @Tuanhoc8 if you want to use the 64bit plugin, yes.

                        T Offline
                        T Offline
                        Tuanhoc8
                        wrote on last edited by
                        #11

                        @Christian-Ehrlicher Thanks you. I will try

                        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