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 driver not loaded in other computers.
Qt 6.11 is out! See what's new in the release blog

MySQL driver not loaded in other computers.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.8k Views 1 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.
  • A Offline
    A Offline
    A.J. Hwang
    wrote on last edited by
    #1

    I made a Qt application with mysql successfully.

    And then I want test it in other computers.

    I zip debug folder with required dlls and send it to my friends.

    Application succesfully starts and working.

    But, when accessing MySQL it says driver not loaded!

    Did I miss something???

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcari
      wrote on last edited by
      #2

      The SQL database drivers are implemented as Qt plugins.
      All Qt plugins are in the "plugins" folder of your Qt installation. In that folder there is a subfolder called sqldrivers and this folder contains a file looking like "mysql.dll" which is the driver plugin for MySQL.
      To solve your issue, you must:
      1/ Create a "plugins" folder in your ZIP so that it will be next to your executable
      2/ Create a "sqldrivers" folder in that "plugins" folder and copy the "mysql.dll" MySQL driver in that folder
      3/ In your main function, call @QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath())@

      This will tell Qt your application to look for plugins in the executable directory. See "this page":http://qt-project.org/doc/qt-4.8/qcoreapplication.html#libraryPaths for more information on Qt, plugins and library paths.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dbzhang800
        wrote on last edited by
        #3

        Hi,
        Create a “sqldrivers” folder in the application's directory, then copy the xxxx.dll plugin to it is enough.
        No "plugins" directory is needed. No "addLibraryPath(...)" is needed.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          A.J. Hwang
          wrote on last edited by
          #4

          God bless rcari and 1+1=2 !

          Thank you for your kind answers ;)

          It really works, and thank you two so much! :)

          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