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. QMYSQL - Ubuntu 18.04.1
QtWS25 Last Chance

QMYSQL - Ubuntu 18.04.1

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 4 Posters 3.1k 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.
  • M Offline
    M Offline
    mbyrd777
    wrote on last edited by
    #1

    Sorry if I'm an idiot. I'm having issues using the MySQL features in qt.

    Getting an error on a project:

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    

    Here's the output of ldd

    ~/Qt/5.11.2/gcc_64/plugins/sqldrivers$ ldd libqsqlmysql.so
    	linux-vdso.so.1 (0x00007ffc87f8b000)
    	libQt5Sql.so.5 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libQt5Sql.so.5 (0x00007f746fd5a000)
    	libQt5Core.so.5 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libQt5Core.so.5 (0x00007f746f600000)
    	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f746f3e1000)
    	libmysqlclient.so.18 => not found
    	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f746f058000)
    	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f746ecba000)
    	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f746eaa2000)
    	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f746e6b1000)
    	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f746e494000)
    	libicui18n.so.56 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libicui18n.so.56 (0x00007f746dffb000)
    	libicuuc.so.56 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libicuuc.so.56 (0x00007f746dc43000)
    	libicudata.so.56 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libicudata.so.56 (0x00007f746c260000)
    	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f746c05c000)
    	libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f746be5a000)
    	libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f746bb44000)
    	/lib64/ld-linux-x86-64.so.2 (0x00007f74701b5000)
    	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f746b8d2000)
    
    

    I'm wondering if it is a version mismatch for the client libraries and I'm too ignorant to fix it? I do have these files.

    /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20
    /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.11
    

    Thanks in advance to anyone that can help.

    mrjjM kshegunovK 2 Replies Last reply
    0
    • M mbyrd777

      Sorry if I'm an idiot. I'm having issues using the MySQL features in qt.

      Getting an error on a project:

      QSqlDatabase: QMYSQL driver not loaded
      QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
      

      Here's the output of ldd

      ~/Qt/5.11.2/gcc_64/plugins/sqldrivers$ ldd libqsqlmysql.so
      	linux-vdso.so.1 (0x00007ffc87f8b000)
      	libQt5Sql.so.5 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libQt5Sql.so.5 (0x00007f746fd5a000)
      	libQt5Core.so.5 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libQt5Core.so.5 (0x00007f746f600000)
      	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f746f3e1000)
      	libmysqlclient.so.18 => not found
      	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f746f058000)
      	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f746ecba000)
      	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f746eaa2000)
      	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f746e6b1000)
      	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f746e494000)
      	libicui18n.so.56 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libicui18n.so.56 (0x00007f746dffb000)
      	libicuuc.so.56 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libicuuc.so.56 (0x00007f746dc43000)
      	libicudata.so.56 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libicudata.so.56 (0x00007f746c260000)
      	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f746c05c000)
      	libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f746be5a000)
      	libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f746bb44000)
      	/lib64/ld-linux-x86-64.so.2 (0x00007f74701b5000)
      	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f746b8d2000)
      
      

      I'm wondering if it is a version mismatch for the client libraries and I'm too ignorant to fix it? I do have these files.

      /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20
      /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.11
      

      Thanks in advance to anyone that can help.

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      @mbyrd777
      Hi and welcome to the forums.

      It seems it tried to load the
      libmysqlclient.so.18
      but yours is named
      libmysqlclient.so.20

      You could try to make a sym link from the
      libmysqlclient.so.18 ( as name ) to libmysqlclient.so.20

      ln -sf /usr/lib/libmysqlclient.so.20 /usr/lib/libmysqlclient.so.18

      CHECK the man page. im known to always switch target and the sym name.

      i cant promise it will work but there is a good chance its compatible.
      If not, its just a link, so should not blow up anything. (much)

      M 1 Reply Last reply
      0
      • mrjjM mrjj

        @mbyrd777
        Hi and welcome to the forums.

        It seems it tried to load the
        libmysqlclient.so.18
        but yours is named
        libmysqlclient.so.20

        You could try to make a sym link from the
        libmysqlclient.so.18 ( as name ) to libmysqlclient.so.20

        ln -sf /usr/lib/libmysqlclient.so.20 /usr/lib/libmysqlclient.so.18

        CHECK the man page. im known to always switch target and the sym name.

        i cant promise it will work but there is a good chance its compatible.
        If not, its just a link, so should not blow up anything. (much)

        M Offline
        M Offline
        mbyrd777
        wrote on last edited by mbyrd777
        #3

        @mrjj That's sort of what I was thinking but I didn't want to cause any sort of unintended consequences and didn't know if there was an official way to handle library differences. Thanks for the tip

        edit: the symlink didn't seem to work as the same error occurred.

        mrjjM 1 Reply Last reply
        0
        • M mbyrd777

          @mrjj That's sort of what I was thinking but I didn't want to cause any sort of unintended consequences and didn't know if there was an official way to handle library differences. Thanks for the tip

          edit: the symlink didn't seem to work as the same error occurred.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @mbyrd777
          Hi
          Well I have done that with various other libs and had no ill side effects as
          its sort of just makes an alias for the lib.
          However, it it really wants the .18 version, the app might crash but
          the link can easy be removed so i find the risk very small for anything bad system wise.

          Update:
          ok. thats odd. I recall a case where it look in the "wrong"/other folder
          /lib/x86_64 and not in /usr/lib/

          Im not super linux experct so lets wait some hours, some of the others mods are very into
          linux :)

          M 1 Reply Last reply
          0
          • mrjjM mrjj

            @mbyrd777
            Hi
            Well I have done that with various other libs and had no ill side effects as
            its sort of just makes an alias for the lib.
            However, it it really wants the .18 version, the app might crash but
            the link can easy be removed so i find the risk very small for anything bad system wise.

            Update:
            ok. thats odd. I recall a case where it look in the "wrong"/other folder
            /lib/x86_64 and not in /usr/lib/

            Im not super linux experct so lets wait some hours, some of the others mods are very into
            linux :)

            M Offline
            M Offline
            mbyrd777
            wrote on last edited by
            #5

            @mrjj For this release of Ubuntu it has the libraries here:

            /usr/lib/x86_64-linux-gnu/
            

            I don't even know where to look to see where qt is trying to access the libraries from

            1 Reply Last reply
            0
            • M mbyrd777

              Sorry if I'm an idiot. I'm having issues using the MySQL features in qt.

              Getting an error on a project:

              QSqlDatabase: QMYSQL driver not loaded
              QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
              

              Here's the output of ldd

              ~/Qt/5.11.2/gcc_64/plugins/sqldrivers$ ldd libqsqlmysql.so
              	linux-vdso.so.1 (0x00007ffc87f8b000)
              	libQt5Sql.so.5 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libQt5Sql.so.5 (0x00007f746fd5a000)
              	libQt5Core.so.5 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libQt5Core.so.5 (0x00007f746f600000)
              	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f746f3e1000)
              	libmysqlclient.so.18 => not found
              	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f746f058000)
              	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f746ecba000)
              	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f746eaa2000)
              	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f746e6b1000)
              	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f746e494000)
              	libicui18n.so.56 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libicui18n.so.56 (0x00007f746dffb000)
              	libicuuc.so.56 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libicuuc.so.56 (0x00007f746dc43000)
              	libicudata.so.56 => /home/matthew/Qt/5.11.2/gcc_64/plugins/sqldrivers/./../../lib/libicudata.so.56 (0x00007f746c260000)
              	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f746c05c000)
              	libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f746be5a000)
              	libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f746bb44000)
              	/lib64/ld-linux-x86-64.so.2 (0x00007f74701b5000)
              	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f746b8d2000)
              
              

              I'm wondering if it is a version mismatch for the client libraries and I'm too ignorant to fix it? I do have these files.

              /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20
              /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.11
              

              Thanks in advance to anyone that can help.

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #6

              @mbyrd777 said in QMYSQL - Ubuntu 18.04.1:

              Sorry if I'm an idiot.

              You're not. :)

              I'm wondering if it is a version mismatch for the client libraries and I'm too ignorant to fix it? I do have these files.

              It is a version mismatch. You need to provide the correct library for the plugin. Did you build Qt yourself?
              Most painless would be to just install the correct client library from the repo though.

              Read and abide by the Qt Code of Conduct

              M 1 Reply Last reply
              0
              • kshegunovK kshegunov

                @mbyrd777 said in QMYSQL - Ubuntu 18.04.1:

                Sorry if I'm an idiot.

                You're not. :)

                I'm wondering if it is a version mismatch for the client libraries and I'm too ignorant to fix it? I do have these files.

                It is a version mismatch. You need to provide the correct library for the plugin. Did you build Qt yourself?
                Most painless would be to just install the correct client library from the repo though.

                M Offline
                M Offline
                mbyrd777
                wrote on last edited by
                #7

                @kshegunov I downloaded the community edition installer today and ran it to install 5.11.2
                I didn't build from source

                kshegunovK 1 Reply Last reply
                0
                • M mbyrd777

                  @kshegunov I downloaded the community edition installer today and ran it to install 5.11.2
                  I didn't build from source

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by
                  #8

                  Okay, I suggest you install libmysqlclient18 from the repo, which should fix your problem.

                  Read and abide by the Qt Code of Conduct

                  M 1 Reply Last reply
                  0
                  • kshegunovK kshegunov

                    Okay, I suggest you install libmysqlclient18 from the repo, which should fix your problem.

                    M Offline
                    M Offline
                    mbyrd777
                    wrote on last edited by
                    #9

                    @kshegunov said in QMYSQL - Ubuntu 18.04.1:

                    libmysqlclient18

                    $ sudo apt-get install libmysqlclient18
                    [sudo] password for matthew: 
                    Reading package lists... Done
                    Building dependency tree       
                    Reading state information... Done
                    Package libmysqlclient18 is not available, but is referred to by another package.
                    This may mean that the package is missing, has been obsoleted, or
                    is only available from another source
                    
                    E: Package 'libmysqlclient18' has no installation candidate
                    
                    kshegunovK JonBJ 2 Replies Last reply
                    0
                    • M mbyrd777

                      @kshegunov said in QMYSQL - Ubuntu 18.04.1:

                      libmysqlclient18

                      $ sudo apt-get install libmysqlclient18
                      [sudo] password for matthew: 
                      Reading package lists... Done
                      Building dependency tree       
                      Reading state information... Done
                      Package libmysqlclient18 is not available, but is referred to by another package.
                      This may mean that the package is missing, has been obsoleted, or
                      is only available from another source
                      
                      E: Package 'libmysqlclient18' has no installation candidate
                      
                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by
                      #10

                      https://packages.ubuntu.com/search?keywords=libmysqlclient&searchon=names&suite=trusty&section=all

                      I don't pretend to understand the Ubuntu release cycle, as I work on debian. However as I see it, you have to pin the trusty repositories with a low priority in the apt configuration, and then you can install it.

                      Read and abide by the Qt Code of Conduct

                      1 Reply Last reply
                      0
                      • M mbyrd777

                        @kshegunov said in QMYSQL - Ubuntu 18.04.1:

                        libmysqlclient18

                        $ sudo apt-get install libmysqlclient18
                        [sudo] password for matthew: 
                        Reading package lists... Done
                        Building dependency tree       
                        Reading state information... Done
                        Package libmysqlclient18 is not available, but is referred to by another package.
                        This may mean that the package is missing, has been obsoleted, or
                        is only available from another source
                        
                        E: Package 'libmysqlclient18' has no installation candidate
                        
                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by JonB
                        #11

                        @mbyrd777
                        Let's start a little bit from scratch here.

                        Why do you want/need any kind of "libmysqlclient18", I mean the 18 instead of the 20?

                        I installed Ubuntu 18.04 from fresh yesterday. Everything default. I get all my Qt/MySQL stuff from the repo, with standard apt-get (e.g. apt-get install qt5-default). I do not get source code or compile anything.

                        Mine works fine, without any issues. I have no "libmysqlclient18" anywhere. I have libmysqlclient.so.20 (libmysqlclient.so.20.3.11 actually).

                        Now, the point is, if anything my Qt/MySQL will be older than yours (e.g. it's Qt 5.9.5), and yet I'm up to libmysqlclient.so.20. So where does your need for 18 come from?

                        P.S.
                        I notice I did a apt-get install libqt5sql5-mysql. Do you do that one?

                        kshegunovK 1 Reply Last reply
                        0
                        • JonBJ JonB

                          @mbyrd777
                          Let's start a little bit from scratch here.

                          Why do you want/need any kind of "libmysqlclient18", I mean the 18 instead of the 20?

                          I installed Ubuntu 18.04 from fresh yesterday. Everything default. I get all my Qt/MySQL stuff from the repo, with standard apt-get (e.g. apt-get install qt5-default). I do not get source code or compile anything.

                          Mine works fine, without any issues. I have no "libmysqlclient18" anywhere. I have libmysqlclient.so.20 (libmysqlclient.so.20.3.11 actually).

                          Now, the point is, if anything my Qt/MySQL will be older than yours (e.g. it's Qt 5.9.5), and yet I'm up to libmysqlclient.so.20. So where does your need for 18 come from?

                          P.S.
                          I notice I did a apt-get install libqt5sql5-mysql. Do you do that one?

                          kshegunovK Offline
                          kshegunovK Offline
                          kshegunov
                          Moderators
                          wrote on last edited by
                          #12

                          @JonB said in QMYSQL - Ubuntu 18.04.1:

                          Why do you want/need any kind of "libmysqlclient18", I mean the 18 instead of the 20?

                          Because the plugin he got from the installer is built against that version.

                          I get all my Qt/MySQL stuff from the repo

                          I do too, however it's not the case here.

                          I have libmysqlclient.so.20 (libmysqlclient.so.20.3.11 actually).

                          Thanks to the maintainers of your distro, they take the time to repackage the binaries appropriately and set the correct dependencies, so you (and I) get it out of the box.

                          Read and abide by the Qt Code of Conduct

                          JonBJ 1 Reply Last reply
                          0
                          • kshegunovK kshegunov

                            @JonB said in QMYSQL - Ubuntu 18.04.1:

                            Why do you want/need any kind of "libmysqlclient18", I mean the 18 instead of the 20?

                            Because the plugin he got from the installer is built against that version.

                            I get all my Qt/MySQL stuff from the repo

                            I do too, however it's not the case here.

                            I have libmysqlclient.so.20 (libmysqlclient.so.20.3.11 actually).

                            Thanks to the maintainers of your distro, they take the time to repackage the binaries appropriately and set the correct dependencies, so you (and I) get it out of the box.

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

                            @kshegunov

                            Because the plugin he got from the installer is built against that version.
                            I didn't get that bit. What installer does he talk about in his question?

                            Oh, do you mean in a later post I just noticed:

                            @kshegunov I downloaded the community edition installer today and ran it to install 5.11.2

                            Anyway, if it has to be like that. I was just mentioning that if he could manage/do as I have I get all the stuff he mentions just with the apt-gets and do not have his issue. Or he can fiddle potentially for days till he sorts out his current situation. It was just a heads-up.

                            kshegunovK 1 Reply Last reply
                            0
                            • JonBJ JonB

                              @kshegunov

                              Because the plugin he got from the installer is built against that version.
                              I didn't get that bit. What installer does he talk about in his question?

                              Oh, do you mean in a later post I just noticed:

                              @kshegunov I downloaded the community edition installer today and ran it to install 5.11.2

                              Anyway, if it has to be like that. I was just mentioning that if he could manage/do as I have I get all the stuff he mentions just with the apt-gets and do not have his issue. Or he can fiddle potentially for days till he sorts out his current situation. It was just a heads-up.

                              kshegunovK Offline
                              kshegunovK Offline
                              kshegunov
                              Moderators
                              wrote on last edited by
                              #14

                              @JonB said in QMYSQL - Ubuntu 18.04.1:

                              Oh, do you mean in a later post I just noticed

                              Indeed.

                              Anyway, if it has to be like that. I was just mentioning that if he could manage/do as I have I get all the stuff he mentions just with the apt-gets and do not have his issue. Or he can fiddle potentially for days till he sorts out his current situation. It was just a heads-up.

                              When I'm not needing a Qt build myself (like trying a patch or something) I personally do it just like you described.

                              Read and abide by the Qt Code of Conduct

                              1 Reply Last reply
                              1

                              • Login

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