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. Mysql can't connect on MacBook
Forum Updated to NodeBB v4.3 + New Features

Mysql can't connect on MacBook

Scheduled Pinned Locked Moved Unsolved General and Desktop
65 Posts 6 Posters 6.0k 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.
  • E Eternus

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
    I have this error I find solution on forum but that wasn't on MacBook someone know how can I fix this ?

    void MainWindow::on_pushButton_login_clicked()
    {

    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("127.0.0.1");
    db.setUserName("root");
    db.setPassword("aaaaa");
    db.setDatabaseName("QTUSERS");
    
    if(db.open()) {
        QMessageBox::information(this,"Connection", "Database connectet");
    } else {
        QMessageBox::information(this,"Connection", "Database not found");
    }
    

    }

    in pro I have sql..
    I have downloaded mysql community ,..

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #2

    @Eternus
    You have to start by setting environment variable in a shell/terminal and then invoking your application from there, to get diagnostic information. I don't know how exactly you do that on Mac, but from Linux:

    export QT_DEBUG_PLUGINS=1
    path-to-your-executable-to-run-it
    

    Look through the end of the output for what the issue is.

    E 1 Reply Last reply
    0
    • E Offline
      E Offline
      Eternus
      wrote on last edited by
      #3

      how can I go in shell ?

      SGaistS 1 Reply Last reply
      0
      • JonBJ JonB

        @Eternus
        You have to start by setting environment variable in a shell/terminal and then invoking your application from there, to get diagnostic information. I don't know how exactly you do that on Mac, but from Linux:

        export QT_DEBUG_PLUGINS=1
        path-to-your-executable-to-run-it
        

        Look through the end of the output for what the issue is.

        E Offline
        E Offline
        Eternus
        wrote on last edited by Eternus
        #4

        @JonB if I install mysql on VPS it will be work???

        1 Reply Last reply
        0
        • E Eternus

          how can I go in shell ?

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

          Hi,

          @Eternus said in Mysql can't connect on MacBook:

          how can I go in shell ?

          Use the Terminal application.

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

          E 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            @Eternus said in Mysql can't connect on MacBook:

            how can I go in shell ?

            Use the Terminal application.

            E Offline
            E Offline
            Eternus
            wrote on last edited by
            #6

            @SGaist

            yes i know but what a command ?
            if i put in these 2 line 2 line dont work

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

              What exactly are you writing in your terminal ?

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

              E 1 Reply Last reply
              0
              • SGaistS SGaist

                What exactly are you writing in your terminal ?

                E Offline
                E Offline
                Eternus
                wrote on last edited by
                #8

                @SGaist

                export QT_DEBUG_PLUGINS=1
                path-to-your-executable-to-run-it

                this first reply

                SGaistS 1 Reply Last reply
                0
                • E Eternus

                  @SGaist

                  export QT_DEBUG_PLUGINS=1
                  path-to-your-executable-to-run-it

                  this first reply

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

                  @Eternus said in Mysql can't connect on MacBook:

                  path-to-your-executable-to-run-it

                  You do realize that this is a placeholder text that you have to replace with the actual path to the executable you are trying to run ?

                  On the other side, you can also define QT_DEBUG_PLUGINS environment variable in the Run part of the Project panel and start your application as usual.

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

                  E 1 Reply Last reply
                  2
                  • SGaistS SGaist

                    @Eternus said in Mysql can't connect on MacBook:

                    path-to-your-executable-to-run-it

                    You do realize that this is a placeholder text that you have to replace with the actual path to the executable you are trying to run ?

                    On the other side, you can also define QT_DEBUG_PLUGINS environment variable in the Run part of the Project panel and start your application as usual.

                    E Offline
                    E Offline
                    Eternus
                    wrote on last edited by
                    #10

                    @SGaist

                    please can u explain me ? i am beginner and starting with qt and c++ soo i dont know much ..

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

                      Explain what ?

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

                      E 2 Replies Last reply
                      0
                      • SGaistS SGaist

                        Explain what ?

                        E Offline
                        E Offline
                        Eternus
                        wrote on last edited by Eternus
                        #12

                        @SGaist
                        how too add qt_debug_plugins...

                        SGaistS 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Explain what ?

                          E Offline
                          E Offline
                          Eternus
                          wrote on last edited by Eternus
                          #13

                          @SGaist I find this https://forum.qt.io/topic/106565/mysql-qt-create-plugin-mysql-for-qt-on-mac

                          can't find thes gunzip qt-everywhere-opensource-src-%VERSION%.tar.gz
                          I have only this : qt5

                          and then I try this https://doc.qt.io/qt-5/macos-building.html
                          I can't find thes gunzip qt-everywhere-opensource-src-%VERSION%.tar.gz
                          I have only this : qt5

                          1 Reply Last reply
                          0
                          • E Eternus

                            @SGaist
                            how too add qt_debug_plugins...

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

                            @Eternus said in Mysql can't connect on MacBook:

                            @SGaist
                            how too add qt_debug_plugins...

                            You do realize that is indicated precisely where you should do it in Qt Creator ?

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

                            E 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              @Eternus said in Mysql can't connect on MacBook:

                              @SGaist
                              how too add qt_debug_plugins...

                              You do realize that is indicated precisely where you should do it in Qt Creator ?

                              E Offline
                              E Offline
                              Eternus
                              wrote on last edited by
                              #15

                              @SGaist ??if I install Mysql on vps should be work ?

                              SGaistS 1 Reply Last reply
                              0
                              • E Eternus

                                @SGaist ??if I install Mysql on vps should be work ?

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

                                @Eternus said in Mysql can't connect on MacBook:

                                @SGaist ??if I install Mysql on vps should be work ?

                                What do you mean ?

                                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
                                • E Offline
                                  E Offline
                                  Eternus
                                  wrote on last edited by
                                  #17

                                  sorry nothing I mean how can I fix this problem ? I think add qt_debug_plugins... this isn't solution ...

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

                                    I never said it would be the solution, the goal is to gather information about why the plugin is not loading in order to fix it. And be careful, the name of the variable is all in upper case.

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

                                    E 1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      I never said it would be the solution, the goal is to gather information about why the plugin is not loading in order to fix it. And be careful, the name of the variable is all in upper case.

                                      E Offline
                                      E Offline
                                      Eternus
                                      wrote on last edited by Eternus
                                      #19

                                      @SGaist
                                      if I start debugging I have same this :
                                      23:08:46: Debugging starts
                                      2020-08-21 23:08:51.949814+0200 Test[946:23566] QPixmap::scaled: Pixmap is a null pixmap
                                      2020-08-21 23:08:53.840401+0200 Test[946:23566] QSqlDatabase: QMYSQL driver not loaded
                                      2020-08-21 23:08:53.840464+0200 Test[946:23566] QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

                                      2020-08-21 23:09:50.887121+0200 Test[946:23566] QSqlDatabasePrivate::addDatabase: duplicate connection name 'qt_sql_default_connection', old connection removed.

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

                                        The application output shows one thing: you are misusing the QSqlDatabase class. It also does not show the plugin loading debug data.

                                        Did you add the QT_DEBUG_PLUGINS variable in Qt Creator like I suggested ? If so, did you set it to 1 ?

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

                                        E 1 Reply Last reply
                                        2
                                        • SGaistS SGaist

                                          The application output shows one thing: you are misusing the QSqlDatabase class. It also does not show the plugin loading debug data.

                                          Did you add the QT_DEBUG_PLUGINS variable in Qt Creator like I suggested ? If so, did you set it to 1 ?

                                          E Offline
                                          E Offline
                                          Eternus
                                          wrote on last edited by
                                          #21

                                          @SGaist sorry iam beginner noob where I need add QT_DEBUG PUGINS where ?

                                          mrjjM 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