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. Set-up MariaDB library file location programmatically?
Forum Update on Monday, May 27th 2025

Set-up MariaDB library file location programmatically?

Scheduled Pinned Locked Moved Solved General and Desktop
85 Posts 7 Posters 34.6k 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.
  • S Offline
    S Offline
    SPlatten
    wrote on 1 Jul 2020, 09:01 last edited by SPlatten 7 Jan 2020, 09:13
    #1

    I'm developing on a MAC. I have MariaDB version 10.4.6 Homebrew installed on my MAC. This is installed in:

    /usr/local/Cellar/mariadb/10.4.6_1
    

    It looks like the library I need to reference is:

    /usr/local/Cellar/mariadb/10.4.6_1/lib/libmariadb.dylib
    

    Can anyone help me to set-up the mySQL / MariaDB driver as they are the same thing on a MAC?

    If possible I'd like to incorporate this into my application and pass any configurable requirements or parameters via the command line.

    Sorry about creating another thread, I did search the existing MYSQL for Qt thread, however its locked and I didn't see anything relevant for a MAC.

    To be clear, when I launch my application I currently get:

    Warning:QSqlDatabase: QMYSQL driver not loaded
    Warning:QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
    

    I've tried:

    install_name_tool -change /usr/local/Cellar/mariadb/10.4.6_1/lib/libmariadb.dylib /Users/simonplatten/Qt/5.14.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
    

    This results in:

    Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input
    

    Kind Regards,
    Sy

    J 1 Reply Last reply 1 Jul 2020, 10:17
    0
    • B Offline
      B Offline
      Bonnie
      wrote on 6 Jul 2020, 08:19 last edited by
      #60

      Hey, Just in case...
      Did you remove "config.cache" before you run qmake again?

      H 1 Reply Last reply 6 Jul 2020, 08:20
      1
      • S SPlatten
        1 Jul 2020, 09:01

        I'm developing on a MAC. I have MariaDB version 10.4.6 Homebrew installed on my MAC. This is installed in:

        /usr/local/Cellar/mariadb/10.4.6_1
        

        It looks like the library I need to reference is:

        /usr/local/Cellar/mariadb/10.4.6_1/lib/libmariadb.dylib
        

        Can anyone help me to set-up the mySQL / MariaDB driver as they are the same thing on a MAC?

        If possible I'd like to incorporate this into my application and pass any configurable requirements or parameters via the command line.

        Sorry about creating another thread, I did search the existing MYSQL for Qt thread, however its locked and I didn't see anything relevant for a MAC.

        To be clear, when I launch my application I currently get:

        Warning:QSqlDatabase: QMYSQL driver not loaded
        Warning:QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
        

        I've tried:

        install_name_tool -change /usr/local/Cellar/mariadb/10.4.6_1/lib/libmariadb.dylib /Users/simonplatten/Qt/5.14.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
        

        This results in:

        Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input
        
        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 1 Jul 2020, 10:17 last edited by
        #2

        @SPlatten First thing in such situations is to start your app with QT_DEBUG_PLUGINS set (https://doc.qt.io/qt-5/deployment-plugins.html#debugging-plugins).
        Also, this questions was asked here many many times, you should use the search function.

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

        J 1 Reply Last reply 1 Jul 2020, 10:43
        1
        • J jsulm
          1 Jul 2020, 10:17

          @SPlatten First thing in such situations is to start your app with QT_DEBUG_PLUGINS set (https://doc.qt.io/qt-5/deployment-plugins.html#debugging-plugins).
          Also, this questions was asked here many many times, you should use the search function.

          J Offline
          J Offline
          JonB
          wrote on 1 Jul 2020, 10:43 last edited by
          #3

          @jsulm
          I could be wrong, but I think in this case it won't help? That is good if the QMYSQL driver not loaded is among the available drivers, but here OP has not got that far, I don't think he has managed to install the driver?

          J 1 Reply Last reply 1 Jul 2020, 11:05
          0
          • J JonB
            1 Jul 2020, 10:43

            @jsulm
            I could be wrong, but I think in this case it won't help? That is good if the QMYSQL driver not loaded is among the available drivers, but here OP has not got that far, I don't think he has managed to install the driver?

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 1 Jul 2020, 11:05 last edited by
            #4

            @JonB Yes, you're right. It looks like the driver is not available at all.

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

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SPlatten
              wrote on 1 Jul 2020, 11:13 last edited by
              #5

              Is there anything you need from me in terms of information?

              This is from the folder:

              /usr/local/Cellar/mariadb/10.4.6_1/lib
              

              ls -l:

              -rw-r--r--   1 simonplatten  staff  230704 28 Sep  2019 libmariadb.3.dylib
              lrwxr-xr-x   1 simonplatten  staff      18 17 Jun  2019 libmariadb.dylib -> libmariadb.3.dylib
              -rw-r--r--   1 simonplatten  staff  336264 17 Jun  2019 libmariadbclient.a
              lrwxr-xr-x   1 simonplatten  staff      18 17 Jun  2019 libmysqlclient.a -> libmariadbclient.a
              lrwxr-xr-x   1 simonplatten  staff      18 17 Jun  2019 libmysqlclient.dylib -> libmariadb.3.dylib
              lrwxr-xr-x   1 simonplatten  staff      18 17 Jun  2019 libmysqlclient_r.a -> libmariadbclient.a
              lrwxr-xr-x   1 simonplatten  staff      18 17 Jun  2019 libmysqlclient_r.dylib -> libmariadb.3.dylib
              -r--r--r--   1 simonplatten  staff   12400 17 Jun  2019 libmysqlservices.a
              drwxr-xr-x   3 simonplatten  staff      96 28 Sep  2019 pkgconfig
              drwxr-xr-x  49 simonplatten  staff    1568 17 Jun  2019 plugin
              

              Kind Regards,
              Sy

              J 1 Reply Last reply 1 Jul 2020, 11:18
              0
              • S SPlatten
                1 Jul 2020, 11:13

                Is there anything you need from me in terms of information?

                This is from the folder:

                /usr/local/Cellar/mariadb/10.4.6_1/lib
                

                ls -l:

                -rw-r--r--   1 simonplatten  staff  230704 28 Sep  2019 libmariadb.3.dylib
                lrwxr-xr-x   1 simonplatten  staff      18 17 Jun  2019 libmariadb.dylib -> libmariadb.3.dylib
                -rw-r--r--   1 simonplatten  staff  336264 17 Jun  2019 libmariadbclient.a
                lrwxr-xr-x   1 simonplatten  staff      18 17 Jun  2019 libmysqlclient.a -> libmariadbclient.a
                lrwxr-xr-x   1 simonplatten  staff      18 17 Jun  2019 libmysqlclient.dylib -> libmariadb.3.dylib
                lrwxr-xr-x   1 simonplatten  staff      18 17 Jun  2019 libmysqlclient_r.a -> libmariadbclient.a
                lrwxr-xr-x   1 simonplatten  staff      18 17 Jun  2019 libmysqlclient_r.dylib -> libmariadb.3.dylib
                -r--r--r--   1 simonplatten  staff   12400 17 Jun  2019 libmysqlservices.a
                drwxr-xr-x   3 simonplatten  staff      96 28 Sep  2019 pkgconfig
                drwxr-xr-x  49 simonplatten  staff    1568 17 Jun  2019 plugin
                
                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 1 Jul 2020, 11:18 last edited by
                #6

                @SPlatten I think you need to build Qt MySQL plug-in first.

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

                1 Reply Last reply
                2
                • S Offline
                  S Offline
                  SPlatten
                  wrote on 1 Jul 2020, 11:22 last edited by SPlatten 7 Jan 2020, 11:26
                  #7

                  Thank you, do you have a link that details how?

                  I'm downloading the MariaDB ODBC driver for MAC now or is this not the same?

                  mariadb-connector-odbc-3.1.9-osx-x86_64

                  Kind Regards,
                  Sy

                  J 1 Reply Last reply 1 Jul 2020, 11:49
                  0
                  • S SPlatten
                    1 Jul 2020, 11:22

                    Thank you, do you have a link that details how?

                    I'm downloading the MariaDB ODBC driver for MAC now or is this not the same?

                    mariadb-connector-odbc-3.1.9-osx-x86_64

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 1 Jul 2020, 11:49 last edited by
                    #8

                    @SPlatten https://doc.qt.io/qt-5/sql-driver.html
                    https://stackoverflow.com/questions/6483523/qt-how-to-getcompile-mysql-driver

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

                    1 Reply Last reply
                    2
                    • S Offline
                      S Offline
                      SPlatten
                      wrote on 1 Jul 2020, 11:55 last edited by SPlatten 7 Jan 2020, 14:25
                      #9

                      @jsulm , thank you.

                      So already I'm struggling with the answer on: https://stackoverflow.com/questions/6483523/qt-how-to-getcompile-mysql-driver

                      I cannot find the driver sources, my Qt path looks like this:

                      /Users/simonplatten/qt/5.14.2/Src
                      

                      There is no plugins folder in there, the only plugins folder is:

                      /Users/simonplatten/qt/5.14.2/clang_64/plugins
                      

                      That doesn't contain a mysql folder. I just did:

                      sudo find / -name sqldrivers/mysql
                      

                      Nothing was found on my system.

                      I've tried to follow the instructions on https://doc.qt.io/qt-5/sql-driver.html#qmysql
                      I fall at the first hurdle, I don't have the environment variable QTDIR set and I think my installation of MariaDB is complicated by the fact it was installed using Homebrew.

                      Kind Regards,
                      Sy

                      J J 2 Replies Last reply 2 Jul 2020, 04:23
                      0
                      • S SPlatten
                        1 Jul 2020, 11:55

                        @jsulm , thank you.

                        So already I'm struggling with the answer on: https://stackoverflow.com/questions/6483523/qt-how-to-getcompile-mysql-driver

                        I cannot find the driver sources, my Qt path looks like this:

                        /Users/simonplatten/qt/5.14.2/Src
                        

                        There is no plugins folder in there, the only plugins folder is:

                        /Users/simonplatten/qt/5.14.2/clang_64/plugins
                        

                        That doesn't contain a mysql folder. I just did:

                        sudo find / -name sqldrivers/mysql
                        

                        Nothing was found on my system.

                        I've tried to follow the instructions on https://doc.qt.io/qt-5/sql-driver.html#qmysql
                        I fall at the first hurdle, I don't have the environment variable QTDIR set and I think my installation of MariaDB is complicated by the fact it was installed using Homebrew.

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 2 Jul 2020, 04:23 last edited by
                        #10

                        @SPlatten said in Set-up MariaDB library file location programmatically?:

                        I cannot find the driver sources

                        Did you install Qt sources?

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

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SPlatten
                          wrote on 2 Jul 2020, 04:41 last edited by
                          #11

                          @jsulm, I don't think so, how do I do that?

                          Kind Regards,
                          Sy

                          J 1 Reply Last reply 2 Jul 2020, 04:44
                          -1
                          • S SPlatten
                            2 Jul 2020, 04:41

                            @jsulm, I don't think so, how do I do that?

                            J Offline
                            J Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on 2 Jul 2020, 04:44 last edited by
                            #12

                            @SPlatten said in Set-up MariaDB library file location programmatically?:

                            how do I do that?

                            If you used online installer you can use Maintenance Tool...

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

                            S 1 Reply Last reply 2 Jul 2020, 04:48
                            0
                            • J jsulm
                              2 Jul 2020, 04:44

                              @SPlatten said in Set-up MariaDB library file location programmatically?:

                              how do I do that?

                              If you used online installer you can use Maintenance Tool...

                              S Offline
                              S Offline
                              SPlatten
                              wrote on 2 Jul 2020, 04:48 last edited by
                              #13

                              @jsulm , I did exactly that before posting my reply, I didn't see any option in it for source code.

                              Kind Regards,
                              Sy

                              J 1 Reply Last reply 2 Jul 2020, 04:50
                              0
                              • S SPlatten
                                2 Jul 2020, 04:48

                                @jsulm , I did exactly that before posting my reply, I didn't see any option in it for source code.

                                J Offline
                                J Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on 2 Jul 2020, 04:50 last edited by
                                #14

                                @SPlatten https://www.qt.io/download-open-source

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

                                S 1 Reply Last reply 2 Jul 2020, 04:54
                                0
                                • J jsulm
                                  2 Jul 2020, 04:50

                                  @SPlatten https://www.qt.io/download-open-source

                                  S Offline
                                  S Offline
                                  SPlatten
                                  wrote on 2 Jul 2020, 04:54 last edited by
                                  #15

                                  @jsulm , I'm confused now, the link posted is to the Open source page. What if I don't intend my application to be open source, once its completed I intend to purchase a license before distribution. Can I build a mySQL driver for Qt without open source?

                                  Kind Regards,
                                  Sy

                                  J 1 Reply Last reply 2 Jul 2020, 04:59
                                  0
                                  • S SPlatten
                                    2 Jul 2020, 04:54

                                    @jsulm , I'm confused now, the link posted is to the Open source page. What if I don't intend my application to be open source, once its completed I intend to purchase a license before distribution. Can I build a mySQL driver for Qt without open source?

                                    J Offline
                                    J Offline
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote on 2 Jul 2020, 04:59 last edited by
                                    #16

                                    @SPlatten said in Set-up MariaDB library file location programmatically?:

                                    once its completed I intend to purchase a license before distribution

                                    I'm not sure QtCompany will agree with that.
                                    You should contact them.

                                    There are many ways to get the source code. For example here: https://download.qt.io/archive/qt/5.15/5.15.0/single/
                                    Or using Git as described here: https://wiki.qt.io/Get_the_Source

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

                                    1 Reply Last reply
                                    1
                                    • H Offline
                                      H Offline
                                      hskoglund
                                      wrote on 2 Jul 2020, 05:00 last edited by
                                      #17

                                      Hi, it might be easier if you use Qt's ODBC plugin (libqsqlodbc.dylib) together with the MariaDB Connector/ODBC

                                      1 Reply Last reply
                                      0
                                      • S Offline
                                        S Offline
                                        SPlatten
                                        wrote on 2 Jul 2020, 05:00 last edited by
                                        #18

                                        @jsulm , if I'm developing it on my own system and no one else is involved or using it, how would this be against any license?

                                        Kind Regards,
                                        Sy

                                        J 1 Reply Last reply 2 Jul 2020, 05:07
                                        0
                                        • S Offline
                                          S Offline
                                          SPlatten
                                          wrote on 2 Jul 2020, 05:01 last edited by SPlatten 7 Feb 2020, 05:02
                                          #19

                                          @hskoglund , thank you, I'll look into it. It seems its available for just about every operating system except MAC.

                                          Kind Regards,
                                          Sy

                                          1 Reply Last reply
                                          0
                                          • S SPlatten
                                            2 Jul 2020, 05:00

                                            @jsulm , if I'm developing it on my own system and no one else is involved or using it, how would this be against any license?

                                            J Offline
                                            J Offline
                                            jsulm
                                            Lifetime Qt Champion
                                            wrote on 2 Jul 2020, 05:07 last edited by
                                            #20

                                            @SPlatten I'm not a lawyer and not working for QtCompany (that's why I suggested to ask the company).
                                            You say: you are now developing an app and you want to release it later as closed source. And you want to buy Qt license when you want to release the app. My point was: QtCompany could say that you actually need the commercial license from the beginning as you're developing a closed source application which is going to be distributed. I may be wrong here, but it is worth checking.

                                            If you're not going to distribute your app then there is no issue.

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

                                            S J.HilkJ 2 Replies Last reply 2 Jul 2020, 05:10
                                            2

                                            1/85

                                            1 Jul 2020, 09:01

                                            • Login

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