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.

MySQL driver not loaded in other computers.

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 965 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
    mengsen
    wrote on last edited by mengsen
    #1

    Thanks all~

    After many attempts, I found that the required files were
    C:\Program Files\MySQL\MySQL Shell 8.0\bin\ -> libcrypto-1_1-x64.dll,libssl-1_1-x64.dll
    C:\Program Files\MySQL\MySQL Server 8.0\lib\ -> libmysql.dll
    into xxx.exe path


    IN QT 5.15
    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???

    I try to

    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 "libmysql.dll" MySQL driver in that folder
    3/ In your main function, call @QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath())@
    
    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
    
    I used the deployment tool windeployqt like windeployqt.exe one_path
    I copy libmysql.dll to binpath and can use it in my env
    I zip this folder and send to my friends, MySQL it says driver not loaded
    

    All Can't Solved

    jsulmJ 1 Reply Last reply
    0
    • M mengsen

      Thanks all~

      After many attempts, I found that the required files were
      C:\Program Files\MySQL\MySQL Shell 8.0\bin\ -> libcrypto-1_1-x64.dll,libssl-1_1-x64.dll
      C:\Program Files\MySQL\MySQL Server 8.0\lib\ -> libmysql.dll
      into xxx.exe path


      IN QT 5.15
      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???

      I try to

      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 "libmysql.dll" MySQL driver in that folder
      3/ In your main function, call @QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath())@
      
      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
      
      I used the deployment tool windeployqt like windeployqt.exe one_path
      I copy libmysql.dll to binpath and can use it in my env
      I zip this folder and send to my friends, MySQL it says driver not loaded
      

      All Can't Solved

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @mengsen said in MySQL driver not loaded in other computers.:

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

      This is not enough.
      Please take a look at https://doc.qt.io/qt-5/windows-deployment.html
      There is explained what needs to be deployed and how. You can also use the Windows deployment tool (same link).

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

      M 1 Reply Last reply
      3
      • jsulmJ jsulm

        @mengsen said in MySQL driver not loaded in other computers.:

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

        This is not enough.
        Please take a look at https://doc.qt.io/qt-5/windows-deployment.html
        There is explained what needs to be deployed and how. You can also use the Windows deployment tool (same link).

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

        @jsulm said in MySQL driver not loaded in other computers.:

        There is explained what needs to be deployed and how. You can also use the Windows deployment tool (same link).

        1. I used the deployment tool windeployqt like windeployqt.exe one_path
        2. I copy libmysql.dll to binpath and can use it in my env
        3. I zip this folder and send to my friends, MySQL it says driver not loaded
        JonBJ jsulmJ 2 Replies Last reply
        0
        • M mengsen

          @jsulm said in MySQL driver not loaded in other computers.:

          There is explained what needs to be deployed and how. You can also use the Windows deployment tool (same link).

          1. I used the deployment tool windeployqt like windeployqt.exe one_path
          2. I copy libmysql.dll to binpath and can use it in my env
          3. I zip this folder and send to my friends, MySQL it says driver not loaded
          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @mengsen
          Then start by asking your users to set environment variable QT_DEBUG_PLUGINS to value 1 in a terminal. Then run your application from there. They will get a whole load of diagnostic output. Look at right near the end. Somewhere there should be information as to what the issue is for being unable to load the driver. You could compare this against the output you get when it's successful.

          M 1 Reply Last reply
          1
          • M mengsen

            @jsulm said in MySQL driver not loaded in other computers.:

            There is explained what needs to be deployed and how. You can also use the Windows deployment tool (same link).

            1. I used the deployment tool windeployqt like windeployqt.exe one_path
            2. I copy libmysql.dll to binpath and can use it in my env
            3. I zip this folder and send to my friends, MySQL it says driver not loaded
            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @mengsen said in MySQL driver not loaded in other computers.:

            I copy libmysql.dll to binpath and can use it in my env

            Plug-ins should be inside plugins sub-folder as described in the link I posted before.
            In your environment it is working because the plug-ins are also available from your Qt installation. You can test locally on a vanilla Windows before sending to your customers (you could use a virtual machine with Windows).

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

            1 Reply Last reply
            1
            • JonBJ JonB

              @mengsen
              Then start by asking your users to set environment variable QT_DEBUG_PLUGINS to value 1 in a terminal. Then run your application from there. They will get a whole load of diagnostic output. Look at right near the end. Somewhere there should be information as to what the issue is for being unable to load the driver. You could compare this against the output you get when it's successful.

              M Offline
              M Offline
              mengsen
              wrote on last edited by
              #6

              @JonB Can I set it on Windows

              JonBJ 1 Reply Last reply
              0
              • M mengsen

                @JonB Can I set it on Windows

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

                @mengsen
                Of course!

                1. Open a Command Prompt.
                2. Type: set QT_DEBUG_PLUGINS=1, then <Enter> key.
                3. Run the executable (presumably by typing its full path).
                4. Look at what you get back in the Command Prompt.

                Try it first on your system where it works. Then try it where it does not. You are usually interested in the end of the diagnostic output, where it indicates why it could not load MySQL driver.

                EDIT Ohhh, I have a bad feeling that under Windows someone said the diagnostic output does not go to the terminal where you run from, like it does under Linux, instead it goes somewhere for Windows logging instead :(

                Yep, see https://www.qtcentre.org/threads/34927-QT_DEBUG__PLUGINS-Windows-7-where-does-it-log-information
                One post said "Then I use sysinternals debugview free utility to monitor the output at run-time."
                See post on this forum https://forum.qt.io/topic/41943/platform-plugin-windows/8

                Hi, just an update on why QT_DEBUG_PLUGINS=1 doesn't work as expected when you launch a Qt app from the command line (as it does on Linux and Macs): I found that for Windows MSVC and MinGW compilers, Qt routes the texts to OutputDebugString(), that's why the CMD window shows no output.

                Instead, to see the output, download "Sysinternal's DbgView":http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

                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