1

I'm already build and install the MySql drive like here.. But still I got the error message QMYSQL driver not loaded. Now it;s say MySql as a available driver. I'm using 64bit windows, Qt creator version 32-bit, mingw81_64 and MySql 64 bit Error is,

" QMYSQL driver not loaded. available drivers: QSQLITE QMARIADB QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7"

Geo Tech
  • 307
  • 3
  • 11

2 Answers2

0

Probably you don't have the libmysql.dll (or libmariadb.dll) in your path. The mechanism is that the MySQL database plugin dll is dynamically loaded runtime, and even if the database plugin itself is present (therefore listed as available), it might fail to load if the libmysql.dll (or libmariadb.dll) is not found.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
zgyarmati
  • 1,135
  • 8
  • 15
0

This question is already answered here. Enough details are provided there. In brief:

  1. Download proper libmysql.lib based on your Qt creator version (32-bit?)
  2. Put that dll in your build directory (to see your project's build directory, click the "Projects" button on the left menu bar on Qt creator and see the "Build directory")
  3. Build and run

Edit 1:

One more thing: when you download different versions of libmysql.dll, do as follows:

  • Right click on your application project and select "Add Library"
  • A dialog opens. Select "External library" radio button and click "Next"
  • For the "Library file", brows for your libmysql.lib and select it
  • In the "Platform" section, select the proper platform (windows, linux, ...)
  • If you are a windows user, make sure to check the "Library inside "debug" or "release" subfolder" checkbox
  • Click next

This is the most reliable way to add a library to your project. Hope this helps.

  • I'm using 64bit windows, Qt creator version 32-bit, mingw81_64 and MySql 64 bit. Is there any problem? – Geo Tech May 26 '20 at 20:30
  • No, there is no problem. Did you follow the above steps? I had the same problem and finally solved by testing different versions of libmysql.dll. I wrote you some other things in my answer. Please see "Edit 1". – Saeed Sayyadipour May 27 '20 at 05:22
  • Thaanks. I'll try it – Geo Tech May 27 '20 at 06:36
  • 1
    Is that libmysql.lib or libmysql.dll ? – Geo Tech May 27 '20 at 12:28
  • Sorry, you're right. You have to select libmysql.lib. – Saeed Sayyadipour May 27 '20 at 22:04
  • Let me know your email. I'll send you a simple example. – Saeed Sayyadipour May 28 '20 at 09:54
  • geotetest@gmail.com – Geo Tech May 28 '20 at 18:59
  • I sent to you a simple example. I could regenerate "driver not loaded" error by removing the libmysql.dll file. But once you copy it in the build directory that error removes. Please notice that in my example, I've assumed that you have MySQL Workbench software installed on your machine, and hence I've set the host name as "127.0.0.1" in my example. If so, the example will run perfectly without any error. But if you have not MySQL installed on your machine, then you may face new errors after the "driver not loaded" error removes. – Saeed Sayyadipour May 29 '20 at 14:00
  • Please notice that as the Google does not allow to send executable files via email, I sent my example through a dropbox link and the download link will expire after a couple days. – Saeed Sayyadipour May 29 '20 at 14:03