Qsqldatabase Qmysql Driver Not Loaded

 admin

Re: QSqlDatabase: QMYSQL driver not loaded but available I have had the similar problem on Kubuntu 14.04 64 bit with the latest 5.3.1 Qt relase downloaded from the qt-project and installed to the /opt. Add the system variable QT_DEBUG_PLUGINS=1 if you want to get full information of why the QPSQL driver has not been loaded. Probably you will discover that Qt is not able to find it. Copy and paste the output here to know what exactly happens. How do I load qmysql driver in Qt? I have the following code that produces these results: I have the following code that produces these results: ('QSQLITE', 'QMYSQL', 'QMYSQL3') QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3.

Active6 months ago

When i tried to connect to mysql, there is a error:

One thing that you should first correct: move the database initialization code after the QApplication object creation. QSqlDatabase: QPSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7 Could not create database object While navigating the results in forward-only mode, the handle of QSqlResult may change. Hibernate to mysql automatic loose connection even use autoReconnect=true in jdbc urlanyone know is there another way to keep connection. I am trying following jdbc url and properties but it's not working with autoReconnect=true.

So i googled it, and i tried :

1.Copy sqldrivers folders to C:QtQt5.8.05.8mingw53_32plugins

2.Copy libmysql.dll to C:QtQt5.8.05.8mingw53_32bin

but the error is still there.

Is there anything i am missing?

Xi ChenXi Chen

5 Answers

There are 64 bit and 32 bit versions of libmysql.dll.rebuilding the Qt Driver is NOT a must.

With the prebuilt version of Qt5.9.1, you still need to use the 32 bit version, it worked even with the 64 version of MySQL installation. without any rebuild of QT plugins or components.Download 32 bit MySQL connector here

This was already answered here: medasumanth answer

Mohammad KananMohammad Kanan
2,93710 gold badges15 silver badges29 bronze badges

Qsqldatabase Qmysql Driver Not Loaded Pyqt

This error generally means that Qt MySQL plugin is fine (as it is listed in available drivers), but you are a missing the MySQL dll (thus preventing the driver to load).

Qsqldatabase Qmysql Driver Not Loaded

Qsqldatabase Qmysql Driver Not Loaded

The way to fix it is to place libmysql.dll somewhere in your PATH, e.g. adding the MySQL installation folder to PATH, or copy libmysql.dll in the same folder you have your exe in.

Benjamin TBenjamin T
  1. You must rebuild mysql driver.
  2. Follow this guide

    Note: you need 3 things:

    a. qt-opensource-xxx-mingw492-xxx.exe for Qt Creator and Qt command Prompt.

    Ven_168C&Dev_0032- Qualcomm Atheros AR9485 Wireless drivers for win 7 32/64bit –21.50 MB Download Qualcomm Atheros AR9485 Wireless drivers Qualcomm Atheros AR9485 Wireless drivers for win 7 32bit 64bit Qualcomm Atheros AR9485 Wireless drivers for win 8 32bit 64bit 2015-08-12. Qualcomm atheros ar9485 driver asus.

    b.qt-everywhere-opensource-src-xxx.zip for Qt source code, needed for mysql.pro file.c.mysql-connector-c-6.1.10-win32.zip needed for lib and include folder.

dantedante

I had the same problem. I could solved it by following Benjamin T advise. - Windows 10 - python 3.7 - PyQt5 - I copied the libmysql.dll file from the python 3.7/lib/site-packages folder to the Python 3.7 executable folder and everything started working just fine!

Qsqldatabase Qmysql Driver Not Loaded Linux

ErickErick

If anyone is stupid as i am so that's for you:What basically you should do is

  1. go to https://downloads.mysql.com/archives/c-c/ and download specifically C !!!!!! MysqlConnector;
  2. place 'libmysql.dll' and 'libmysql.lib' ('mysql-connector-c-6.1.11-winx64.zipmysql-connector-c-6.1.11-winx64lib') into 'c:path_to_qtqt_versionyour_compilerbin' for me it looked like 'c:Qt5.12.1mingw73_64bin';
  3. reload creator and voila your mysql driver is perfectly loaded;

So basically for those who want to understand what happened here:

That 'qsqlmysql' plugin is basically a qt interface that uses mysql-C connector methods.But unfortunately this connector does not distributed with Qt, so you should provide it by yourself.

If you want to distribute your software you should copy 'libmysql.dll' into the folder with your '.exe' file.

I hope this will help someone save some time (3hours for me :) ).

Qsqldatabase Qmysql Driver Not Loaded Ubuntu Qt5

APetrovskyAPetrovsky

Qsqldatabase Qmysql Driver Not Loaded

Not the answer you're looking for? Browse other questions tagged c++mysqlqt or ask your own question.