Results 1 to 3 of 3

Thread: MYSQL Driver Not Loaded QT5.7 CentOS 7

  1. #1
    Join Date
    Dec 2016
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default MYSQL Driver Not Loaded QT5.7 CentOS 7

    I have installed mariaDB on CentOS 7 and am trying to build and run with MySQL using QT 5.7.
    Having done my best to follow all documentation I could find and all of the other threads I have been able to understand on this issue, I am still coming up with "Driver Not Loaded" when I execute.

    I'm using the LGPL version of Qt 5.7.

    I tried the following:
    I have /usr/lib64/libmysqlclient.so.18.0.0 with libmsyqlclient.so.18, libmysqlclient_r.so.18, and libmysqlclient.so all symbolically linked to it.
    I tried in my makefile, LIBS += /usr/lib64/MySQL -lmysqlclient_r -lmysqlclient.
    I compiled successfully, but when I ran, open() failed with the error "Driver not loaded."

    Next I tried:
    I have /opt/Qt/5.7/gcc_64/plugins/sqldrivers/libsqlmysql.so
    I tried in my makefile, LIBS += -L/opt/Qt/5.7/gcc_64/plugins/sqldrivers/ -lsqlmysql.so.
    I compiled with warnings that the libmysqlclient.so.16 was missing.

    Following suggestions in some other threads, I symbolically linked libmysqlclient.so.16 and libsqlclient_r.so.16 to libmysqlclient.so and recompiled successfully.
    But when I ran, open() still failed with the error "Driver not loaded"

    What am I doing wrong? (And yes, I really have tried to find and understand the answer from the many other threads asking the similar question.
    Last edited by fsh; 19th December 2016 at 23:09.

  2. #2
    Join Date
    Dec 2016
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: MYSQL Driver Not Loaded QT5.7 CentOS 7

    Ok, so I included both lib paths and suddenly it started working. Not sure why. I thought I tried that before unsuccessfully. NEVERMIND.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: MYSQL Driver Not Loaded QT5.7 CentOS 7

    Have you put your Qt MySQL driver and your client library in an sqldrivers subdirectory of the directory that contains your executable? That is, you should have:

    myprogram (exe)
    sqldrivers/libmysqlclient.so
    sqldrivers/libqsqlmysql.so

    Have you run ldd libmysqlclient.so to make sure there are no other run-time dependencies? If the dependencies can't be found at runtime, you will get the "Driver not loaded" message.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  4. The following user says thank you to d_stranz for this useful post:

    fsh (17th June 2017)

Similar Threads

  1. Replies: 4
    Last Post: 25th November 2017, 17:12
  2. CentOS 6: QMYSQL driver not loaded, available driver: (none)
    By mp33919 in forum Installation and Deployment
    Replies: 1
    Last Post: 19th October 2016, 15:46
  3. MySQL driver , I have, it still not loaded
    By bigkoma in forum Qt Programming
    Replies: 14
    Last Post: 30th January 2011, 10:38
  4. MySQL Driver not loaded on PC without Qt
    By KTvsPeacock in forum Installation and Deployment
    Replies: 39
    Last Post: 20th September 2010, 21:37
  5. Sql Driver: MYSQL not loaded
    By stilgar in forum Qt Programming
    Replies: 2
    Last Post: 15th June 2010, 10:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.