Results 1 to 7 of 7

Thread: QMYSQL Driver not found

  1. #1
    Join Date
    Jun 2012
    Posts
    33
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QMYSQL Driver not found

    I created a program in QT with the QMYSQL driver. On my computer and when testing everything seems to work fine with the program. When I compile a release and copy it to another computer I get the message that QMYSQL driver is not loaded.

    Any ideas on how to build with MYSQL running?

    Thanks,

    Pericles

  2. #2
    Join Date
    Oct 2010
    Location
    Bangalore
    Posts
    52
    Thanks
    8
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL Driver not found

    in your release folder make dir plugins in plugins copy mysql.dll and add below lines in your code

    Qt Code:
    1. QString pFileName("databasename");
    2.  
    3. str.append(".");
    4. qApp->setLibraryPaths(str);
    5. qApp->addLibraryPath("./plugins/");
    6.  
    7. qDebug()<<"my library path : "<<qApp->libraryPaths();
    8.  
    9. QLibrary Mysqlib("libMysql.so");
    10. Mysqlib.load();
    11. qDebug()<<"my library loaded"<< Mysqlib.isLoaded();
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jun 2012
    Posts
    33
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL Driver not found

    The code says that I should have a libmysql.so.
    I added the folder and the libmysql.dll file from C:\Windows
    But now it seems that not even my development machine works. When I remove the new code the development machine works but when I added back it does not work.

    Thanks,

    Pericles

  4. #4
    Join Date
    Jun 2012
    Posts
    33
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMYSQL Driver not found

    I copied the whole plugins folder which includes the sqldrivers folder within it and it seems to do something. Gives me a different error but it might be because it cannot find the remote database and not due to the driver.

    I will check that out again by installing MySQL locally and testing on the user computer and then trying to get the remote database to work.

    Thanks,

    Pericles

  5. #5
    Join Date
    Oct 2010
    Location
    Bangalore
    Posts
    52
    Thanks
    8
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QMYSQL Driver not found

    qt default it will search in qt dir(c://qt/plugins) for plugins when you run this executable in different machine you should give the library path otherwise it will search again same path(c://qt/plugins) .

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QMYSQL Driver not found

    This has been covered many times in this forum

    You need to deploy the Qt MySQL plugin and the MySQL client library that it depends on along with your application. You deployed application should be arranged like this (Windows):
    Qt Code:
    1. C:\Program Files\
    2. Cool App Dir\
    3. coolapp.exe
    4. qtcore4.dll
    5. qtgui4.dll
    6. qtsql4.dll
    7. ...
    8. imageformats\
    9. qjeg4.dll
    10. qgif4.dll
    11. ...
    12. sqldrivers\
    13. qmysql.dll // <<< the Qt Mysql plugin
    14. libmysql.dll // <<< The MySQL client library from the MySql distribution
    15.  
    16. plugins\
    17. // any custom plugin you have written for your program to load directly
    To copy to clipboard, switch view to plain text mode 
    There is no need to do anything with the Qt library path if you arrange it like that.

  7. #7
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QMYSQL Driver not found

    And here's how to build qt mysql plugin.

Similar Threads

  1. QMysql path not found
    By Cayan in forum Installation and Deployment
    Replies: 1
    Last Post: 23rd August 2011, 04:19
  2. Help with QMYSQL driver for QT 4.4.0: driver not loaded
    By khikho in forum Installation and Deployment
    Replies: 4
    Last Post: 1st April 2011, 15:00
  3. QMYSQL: The specified module could not be found
    By jonny_wonny in forum Qt Programming
    Replies: 0
    Last Post: 22nd November 2009, 01:28
  4. QMYSQL driver
    By pcaeiro in forum Qt Programming
    Replies: 2
    Last Post: 3rd September 2009, 14:35
  5. QMYSQL driver
    By Fastman in forum Installation and Deployment
    Replies: 2
    Last Post: 26th October 2007, 08:14

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
  •  
Qt is a trademark of The Qt Company.