Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. I had complied qsqlmysql.dll.
Forum Updated to NodeBB v4.3 + New Features

I had complied qsqlmysql.dll.

Scheduled Pinned Locked Moved Unsolved Qt 6
28 Posts 4 Posters 4.4k 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.
  • yuyuY Offline
    yuyuY Offline
    yuyu
    wrote on last edited by
    #1

    I use mysql 8.0

    mysqld --initialize --console
    mysqld install
    net start mysql
    

    I complied my driver,like this

    7.png

    I had complied qsqlmysql.dll qsqlmysql.debug.

    And I copy it to C:\Qt\6.3.0\mingw_64\plugins\sqldrivers.
    I copy to libmysql.dll and libmysql.lib to C:\Qt\6.3.0\mingw_64\bin.

    when I run my application,has some error .

    1.QSqlDatabase: QMYSQL driver not loaded
    2.command aborted

           database=QSqlDatabase::addDatabase("QMYSQL","asd");
        database.setHostName("127.0.0.1");
        database.setDatabaseName("mydb");     
        database.setUserName("root");
        database.setPassword("123456");   
        if (!database.open()) {
    
            qDebug()<<database.lastError();
        }
    
    

    help me , I am crazying.

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

      @yuyu said in I had complied qsqlmysql.dll.:

      help me , I am crazying.

      Why not using the search function? It's a very powerful thing...

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

      yuyuY 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        @yuyu said in I had complied qsqlmysql.dll.:

        help me , I am crazying.

        Why not using the search function? It's a very powerful thing...

        yuyuY Offline
        yuyuY Offline
        yuyu
        wrote on last edited by
        #3

        I do not find the answer, I used qt6.3.

        1 Reply Last reply
        0
        • yuyuY Offline
          yuyuY Offline
          yuyu
          wrote on last edited by
          #4

          QLibraryPrivate::loadPlugin failed on "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library C:\Qt\6.3.0\mingw_64\plugins\sqldrivers\qsqlmysql.dll

          but there has the qsqlmysql.dll,i complied

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

            You should post the whole output of QT_DEBUG_PLUGINS and make sure (as in all other threads you will find here) that the dependencies of the plugin (= mysql dlls) are found - so that they're either in the path or parallel to the plugin.

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

            1 Reply Last reply
            1
            • yuyuY Offline
              yuyuY Offline
              yuyu
              wrote on last edited by
              #6

              I had success when I use mysql5.7,but the same way it is error when I use mysql8

              jsulmJ 1 Reply Last reply
              0
              • yuyuY yuyu

                I had success when I use mysql5.7,but the same way it is error when I use mysql8

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @yuyu As @Christian-Ehrlicher suggested set QT_DEBUG_PLUGINS environment variable to 1 before running your app and then check its out put - it should tell you why qsqlmysql.dll could not be loaded.

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

                yuyuY 2 Replies Last reply
                0
                • jsulmJ jsulm

                  @yuyu As @Christian-Ehrlicher suggested set QT_DEBUG_PLUGINS environment variable to 1 before running your app and then check its out put - it should tell you why qsqlmysql.dll could not be loaded.

                  yuyuY Offline
                  yuyuY Offline
                  yuyu
                  wrote on last edited by
                  #8

                  @jsulm I Had set but it tell me load error.I look up the qt doc.
                  75f60e43-53c7-46d7-bfaf-4cd7e73678bc-image.png
                  I do not know what is mean the note.

                  1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @yuyu As @Christian-Ehrlicher suggested set QT_DEBUG_PLUGINS environment variable to 1 before running your app and then check its out put - it should tell you why qsqlmysql.dll could not be loaded.

                    yuyuY Offline
                    yuyuY Offline
                    yuyu
                    wrote on last edited by yuyu
                    #9

                    @jsulm said in I had complied qsqlmysql.dll.:

                    QT_DEBUG_PLUGINS
                    8904559d-35ac-49a3-94c1-98c7d5f89ee2-image.png
                    a146f299-8ca0-4c07-983d-8b6d1c41a0ed-image.png

                    jsulmJ 1 Reply Last reply
                    0
                    • yuyuY yuyu

                      @jsulm said in I had complied qsqlmysql.dll.:

                      QT_DEBUG_PLUGINS
                      8904559d-35ac-49a3-94c1-98c7d5f89ee2-image.png
                      a146f299-8ca0-4c07-983d-8b6d1c41a0ed-image.png

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @yuyu Please post text not images.
                      We need to see the actual error after :
                      Currently there are unreadable characters.

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

                      yuyuY 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @yuyu Please post text not images.
                        We need to see the actual error after :
                        Currently there are unreadable characters.

                        yuyuY Offline
                        yuyuY Offline
                        yuyu
                        wrote on last edited by
                        #11

                        @jsulm

                        qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
                        qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll"
                        qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
                        {
                            "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                            "MetaData": {
                                "Keys": [
                                    "QMYSQL",
                                    "QMARIADB"
                                ]
                            },
                            "archlevel": 2,
                            "className": "QMYSQLDriverPlugin",
                            "debug": true,
                            "version": 393984
                        }
                        
                        qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library C:\\Qt\\6.3.0\\mingw_64\\plugins\\sqldrivers\\qsqlmysql.dll
                        

                        I had success when i use mysql5.7 ,but the same way there has error when i use mysql8.0.22

                        jsulmJ 1 Reply Last reply
                        0
                        • yuyuY yuyu

                          @jsulm

                          qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
                          qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll"
                          qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
                          {
                              "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                              "MetaData": {
                                  "Keys": [
                                      "QMYSQL",
                                      "QMARIADB"
                                  ]
                              },
                              "archlevel": 2,
                              "className": "QMYSQLDriverPlugin",
                              "debug": true,
                              "version": 393984
                          }
                          
                          qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library C:\\Qt\\6.3.0\\mingw_64\\plugins\\sqldrivers\\qsqlmysql.dll
                          

                          I had success when i use mysql5.7 ,but the same way there has error when i use mysql8.0.22

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @yuyu said in I had complied qsqlmysql.dll.:

                          qsqlmysql.dll

                          In your other output there is some unreadable characters after qsqlmysql.dll:
                          Can you provide that part as readable text?

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

                          yuyuY 1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            @yuyu said in I had complied qsqlmysql.dll.:

                            qsqlmysql.dll

                            In your other output there is some unreadable characters after qsqlmysql.dll:
                            Can you provide that part as readable text?

                            yuyuY Offline
                            yuyuY Offline
                            yuyu
                            wrote on last edited by yuyu
                            #13

                            @jsulm the unreadable characters is what I use qDebug output chineses,I had delete it.
                            now
                            mycode

                             qDebug() << QSqlDatabase::drivers();
                            
                                QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
                                db.setHostName("localhost");
                                db.setPort(3306);
                                db.setDatabaseName("mydb");
                                db.setUserName("root");
                                db.setPassword("123456");
                                bool ok = db.open();
                            

                            the console

                            
                            16:45:13: Debugging D:\1a_perfect\build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug\debug\testsql.exe ...
                            qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/platforms" ...
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qdirect2d.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qdirect2d.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                "MetaData": {
                                    "Keys": [
                                        "direct2d"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QWindowsDirect2DIntegrationPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("direct2d")
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qminimal.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qminimal.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                "MetaData": {
                                    "Keys": [
                                        "minimal"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QMinimalIntegrationPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal")
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qoffscreen.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qoffscreen.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                "MetaData": {
                                    "Keys": [
                                        "offscreen"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QOffscreenIntegrationPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen")
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qwindows.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qwindows.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                "MetaData": {
                                    "Keys": [
                                        "windows"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QWindowsIntegrationPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("windows")
                            qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/platforms" ...
                            qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/platforms/qwindows.dll" loaded library
                            qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/platformthemes" ...
                            qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/platformthemes" ...
                            qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/styles" ...
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/styles/qwindowsvistastyle.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/styles/qwindowsvistastyle.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QStyleFactoryInterface",
                                "MetaData": {
                                    "Keys": [
                                        "windowsvista"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QWindowsVistaStylePlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("windowsvista")
                            qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/styles" ...
                            qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/styles/qwindowsvistastyle.dll" loaded library
                            qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/iconengines" ...
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/iconengines/qsvgicon.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/iconengines/qsvgicon.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QIconEngineFactoryInterface",
                                "MetaData": {
                                    "Keys": [
                                        "svg",
                                        "svgz",
                                        "svg.gz"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QSvgIconPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("svg", "svgz", "svg.gz")
                            qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/iconengines" ...
                            qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/imageformats" ...
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qgif.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qgif.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
                                "MetaData": {
                                    "Keys": [
                                        "gif"
                                    ],
                                    "MimeTypes": [
                                        "image/gif"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QGifPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("gif")
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qico.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qico.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
                                "MetaData": {
                                    "Keys": [
                                        "ico",
                                        "cur"
                                    ],
                                    "MimeTypes": [
                                        "image/vnd.microsoft.icon",
                                        "image/vnd.microsoft.icon"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QICOPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("ico", "cur")
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qjpeg.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qjpeg.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
                                "MetaData": {
                                    "Keys": [
                                        "jpg",
                                        "jpeg"
                                    ],
                                    "MimeTypes": [
                                        "image/jpeg",
                                        "image/jpeg"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QJpegPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("jpg", "jpeg")
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qsvg.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qsvg.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
                                "MetaData": {
                                    "Keys": [
                                        "svg",
                                        "svgz"
                                    ],
                                    "MimeTypes": [
                                        "image/svg+xml",
                                        "image/svg+xml-compressed"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QSvgPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("svg", "svgz")
                            qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/imageformats" ...
                            qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qgif.dll" loaded library
                            qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qico.dll" loaded library
                            qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qjpeg.dll" loaded library
                            qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qsvg.dll" loaded library
                            qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers" ...
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlite.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlite.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                "MetaData": {
                                    "Keys": [
                                        "QSQLITE"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QSQLiteDriverPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                "MetaData": {
                                    "Keys": [
                                        "QMYSQL",
                                        "QMARIADB"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QMYSQLDriverPlugin",
                                "debug": true,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMYSQL", "QMARIADB")
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlodbc.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                "MetaData": {
                                    "Keys": [
                                        "QODBC"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QODBCDriverPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QODBC")
                            qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlpsql.dll"
                            qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlpsql.dll, metadata=
                            {
                                "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                "MetaData": {
                                    "Keys": [
                                        "QPSQL"
                                    ]
                                },
                                "archlevel": 2,
                                "className": "QPSQLDriverPlugin",
                                "debug": false,
                                "version": 393984
                            }
                            
                            qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL")
                            qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/sqldrivers" ...
                            QList("QSQLITE", "QMARIADB", "QMYSQL", "QODBC", "QPSQL")
                            qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" loaded library
                            qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/accessible" ...
                            qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/accessible" ...
                            qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/accessiblebridge" ...
                            qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/accessiblebridge" ...
                            
                            jsulmJ 1 Reply Last reply
                            0
                            • yuyuY yuyu

                              @jsulm the unreadable characters is what I use qDebug output chineses,I had delete it.
                              now
                              mycode

                               qDebug() << QSqlDatabase::drivers();
                              
                                  QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
                                  db.setHostName("localhost");
                                  db.setPort(3306);
                                  db.setDatabaseName("mydb");
                                  db.setUserName("root");
                                  db.setPassword("123456");
                                  bool ok = db.open();
                              

                              the console

                              
                              16:45:13: Debugging D:\1a_perfect\build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug\debug\testsql.exe ...
                              qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/platforms" ...
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qdirect2d.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qdirect2d.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                  "MetaData": {
                                      "Keys": [
                                          "direct2d"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QWindowsDirect2DIntegrationPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("direct2d")
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qminimal.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qminimal.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                  "MetaData": {
                                      "Keys": [
                                          "minimal"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QMinimalIntegrationPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("minimal")
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qoffscreen.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qoffscreen.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                  "MetaData": {
                                      "Keys": [
                                          "offscreen"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QOffscreenIntegrationPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("offscreen")
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/platforms/qwindows.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/platforms/qwindows.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                  "MetaData": {
                                      "Keys": [
                                          "windows"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QWindowsIntegrationPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("windows")
                              qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/platforms" ...
                              qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/platforms/qwindows.dll" loaded library
                              qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/platformthemes" ...
                              qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/platformthemes" ...
                              qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/styles" ...
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/styles/qwindowsvistastyle.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/styles/qwindowsvistastyle.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QStyleFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "windowsvista"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QWindowsVistaStylePlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("windowsvista")
                              qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/styles" ...
                              qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/styles/qwindowsvistastyle.dll" loaded library
                              qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/iconengines" ...
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/iconengines/qsvgicon.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/iconengines/qsvgicon.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QIconEngineFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "svg",
                                          "svgz",
                                          "svg.gz"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QSvgIconPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("svg", "svgz", "svg.gz")
                              qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/iconengines" ...
                              qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/imageformats" ...
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qgif.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qgif.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "gif"
                                      ],
                                      "MimeTypes": [
                                          "image/gif"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QGifPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("gif")
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qico.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qico.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "ico",
                                          "cur"
                                      ],
                                      "MimeTypes": [
                                          "image/vnd.microsoft.icon",
                                          "image/vnd.microsoft.icon"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QICOPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("ico", "cur")
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qjpeg.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qjpeg.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "jpg",
                                          "jpeg"
                                      ],
                                      "MimeTypes": [
                                          "image/jpeg",
                                          "image/jpeg"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QJpegPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("jpg", "jpeg")
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qsvg.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/imageformats/qsvg.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "svg",
                                          "svgz"
                                      ],
                                      "MimeTypes": [
                                          "image/svg+xml",
                                          "image/svg+xml-compressed"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QSvgPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("svg", "svgz")
                              qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/imageformats" ...
                              qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qgif.dll" loaded library
                              qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qico.dll" loaded library
                              qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qjpeg.dll" loaded library
                              qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/imageformats/qsvg.dll" loaded library
                              qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers" ...
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlite.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlite.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QSQLITE"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QSQLiteDriverPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QSQLITE")
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QMYSQL",
                                          "QMARIADB"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QMYSQLDriverPlugin",
                                  "debug": true,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QMYSQL", "QMARIADB")
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlodbc.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlodbc.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QODBC"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QODBCDriverPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QODBC")
                              qt.core.plugin.factoryloader: looking at "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlpsql.dll"
                              qt.core.plugin.loader: Found metadata in lib C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlpsql.dll, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QPSQL"
                                      ]
                                  },
                                  "archlevel": 2,
                                  "className": "QPSQLDriverPlugin",
                                  "debug": false,
                                  "version": 393984
                              }
                              
                              qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL")
                              qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/sqldrivers" ...
                              QList("QSQLITE", "QMARIADB", "QMYSQL", "QODBC", "QPSQL")
                              qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" loaded library
                              qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/accessible" ...
                              qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/accessible" ...
                              qt.core.plugin.factoryloader: checking directory path "C:/Qt/6.3.0/mingw_64/plugins/accessiblebridge" ...
                              qt.core.plugin.factoryloader: checking directory path "D:/1a_perfect/build-testsql-Desktop_Qt_6_3_0_MinGW_64_bit-Debug/debug/accessiblebridge" ...
                              
                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @yuyu said in I had complied qsqlmysql.dll.:

                              qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" loaded library

                              Looks good now

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

                              yuyuY 1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @yuyu said in I had complied qsqlmysql.dll.:

                                qt.core.library: "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" loaded library

                                Looks good now

                                yuyuY Offline
                                yuyuY Offline
                                yuyu
                                wrote on last edited by
                                #15

                                @jsulm I can not connect my mysql database .

                                jsulmJ NevezN 2 Replies Last reply
                                0
                                • yuyuY yuyu

                                  @jsulm I can not connect my mysql database .

                                  jsulmJ Offline
                                  jsulmJ Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  @yuyu What does db.open() return?
                                  What does https://doc.qt.io/qt-5/qsqldatabase.html#lastError return after open() call?

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

                                  yuyuY 1 Reply Last reply
                                  0
                                  • yuyuY yuyu

                                    @jsulm I can not connect my mysql database .

                                    NevezN Offline
                                    NevezN Offline
                                    Nevez
                                    wrote on last edited by
                                    #17

                                    @yuyu Still getting driver not installed error? and yes share the result of db.open() as well.

                                    1 Reply Last reply
                                    0
                                    • jsulmJ jsulm

                                      @yuyu What does db.open() return?
                                      What does https://doc.qt.io/qt-5/qsqldatabase.html#lastError return after open() call?

                                      yuyuY Offline
                                      yuyuY Offline
                                      yuyu
                                      wrote on last edited by
                                      #18

                                      @jsulm false

                                      jsulmJ 1 Reply Last reply
                                      0
                                      • yuyuY yuyu

                                        @jsulm false

                                        jsulmJ Offline
                                        jsulmJ Offline
                                        jsulm
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #19

                                        @yuyu I asked two questions. Would you be so kind to also answer the second one?

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

                                        yuyuY 1 Reply Last reply
                                        0
                                        • jsulmJ jsulm

                                          @yuyu I asked two questions. Would you be so kind to also answer the second one?

                                          yuyuY Offline
                                          yuyuY Offline
                                          yuyu
                                          wrote on last edited by
                                          #20

                                          @Nevez yes,but I had install it. it return false.
                                          sometime has
                                          42e82386-47d7-4a05-91c6-2934dd95689d-image.png

                                          qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "C:/Qt/6.3.0/mingw_64/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library C:\\Qt\\6.3.0\\mingw_64\\plugins\\sqldrivers\\qsqlmysql.dll:
                                          
                                          jsulmJ NevezN 2 Replies 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