<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QMYSQL driver not loaded Error]]></title><description><![CDATA[<p dir="auto">Re: <a href="/topic/53262/qsqldatabase-qmysql-driver-not-loaded-available-drivers-qmysql">QSqlDatabase: QMYSQL driver not loaded available drivers: QMYSQL</a></p>
<p dir="auto">I have the same problem.<br />
I read the question and answers in many topics that had my problem but couldn't solve my problem.<br />
I use Qt 5.9.6 mingw32 and 64 bit windows,i have MySql 5.7 installed.<br />
I don't know how to build the drivers myself(if it is necessary).<br />
here is my system path:</p>
<pre><code>C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;
%SystemRoot%\system32;
%SystemRoot%;%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;
C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;
C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;
C:\Strawberry\perl\bin;
C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin\;
C:\Program Files\IVI Foundation\VISA\Win64\Bin\;
C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;
C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 &amp; MySQL Utilities 1.5\;
C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 &amp; MySQL Utilities 1.5\Doctrine extensions for PHP\
</code></pre>
<p dir="auto">my code has only one line:</p>
<pre><code>QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
</code></pre>
<p dir="auto">and I have added qt += sql in my .pro file</p>
]]></description><link>https://forum.qt.io/topic/96048/qmysql-driver-not-loaded-error</link><generator>RSS for Node</generator><lastBuildDate>Thu, 07 May 2026 10:05:31 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/96048.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 Oct 2018 05:45:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QMYSQL driver not loaded Error on Wed, 31 Oct 2018 10:14:02 GMT]]></title><description><![CDATA[<p dir="auto">For people that have this Problem:<br />
<a href="https://stackoverflow.com/questions/21450861/why-qmysql-driver-not-loaded-in-qt5-2/30925765#30925765" target="_blank" rel="noopener noreferrer nofollow ugc">this solved my problem</a></p>
]]></description><link>https://forum.qt.io/post/490305</link><guid isPermaLink="true">https://forum.qt.io/post/490305</guid><dc:creator><![CDATA[rezaMSLM]]></dc:creator><pubDate>Wed, 31 Oct 2018 10:14:02 GMT</pubDate></item><item><title><![CDATA[Reply to QMYSQL driver not loaded Error on Wed, 31 Oct 2018 06:24:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> said in <a href="/post/490130">QMYSQL driver not loaded Error</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rezamslm">@<bdi>rezaMSLM</bdi></a><br />
Because your folder name has spaces in it, when you changed the command line you don't seem to have done the necessary quoting?  Does the following work better:</p>
<pre><code>qmake -- "MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 5.7/include" "MYSQL_LIBDIR=C:\Program Files\MySQL\MySQL Server 5.7/lib/opt"
</code></pre>
<p dir="auto">Otherwise, although it may be OK, you are mixing <code>\</code>s and <code>/</code>s in your version, is that an issue?</p>
</blockquote>
<p dir="auto">I Tried both</p>
<pre><code>qmake -- MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 5.7/include "MYSQL_LIBDIR=C:\Program Files\MySQL\MySQL Server 5.7/lib/opt"
</code></pre>
<p dir="auto">and</p>
<pre><code>qmake -- "MYSQL_INCDIR=C:/Program Files/MySQL/MySQL Server 5.7/include" "MYSQL_LIBDIR=C:/Program Files/MySQL/MySQL Server 5.7/lib/opt"
</code></pre>
<p dir="auto">but receive the same error:</p>
<pre><code>D:\Qt\Qt5.9.6\5.9.6\Src\qtbase\src\plugins\sqldrivers\qtsqldrivers-config.pri: the system cannot find the file specified.
project ERROR: Library 'mysql' is not defined.
</code></pre>
<p dir="auto">EDIT:</p>
<p dir="auto">I have no folder named "opt" in "C:/Program Files/MySQL/MySQL Server 5.7/lib"<br />
my mysql.h file is in</p>
<pre><code>C:\Program Files\MySQL\MySQL Server 5.7\include
</code></pre>
<p dir="auto">and libmysql.lib is in</p>
<pre><code>C:\Program Files\MySQL\MySQL Server 5.7\lib
</code></pre>
<p dir="auto">so I used this code:</p>
<pre><code>qmake -- "MYSQL_INCDIR=C:/Program Files/MySQL/MySQL Server 5.7/include" "MYSQL_LIBDIR=C:/Program Files/MySQL/MySQL Server 5.7/lib"
</code></pre>
<p dir="auto">but have the same error</p>
]]></description><link>https://forum.qt.io/post/490211</link><guid isPermaLink="true">https://forum.qt.io/post/490211</guid><dc:creator><![CDATA[rezaMSLM]]></dc:creator><pubDate>Wed, 31 Oct 2018 06:24:11 GMT</pubDate></item><item><title><![CDATA[Reply to QMYSQL driver not loaded Error on Tue, 30 Oct 2018 20:41:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rezamslm">@<bdi>rezaMSLM</bdi></a><br />
Because your folder name has spaces in it, when you changed the command line you don't seem to have done the necessary quoting?  Does the following work better:</p>
<pre><code>qmake -- "MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 5.7/include" "MYSQL_LIBDIR=C:\Program Files\MySQL\MySQL Server 5.7/lib/opt"
</code></pre>
<p dir="auto">Otherwise, although it may be OK, you are mixing <code>\</code>s and <code>/</code>s in your version, is that an issue?</p>
]]></description><link>https://forum.qt.io/post/490130</link><guid isPermaLink="true">https://forum.qt.io/post/490130</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Tue, 30 Oct 2018 20:41:02 GMT</pubDate></item><item><title><![CDATA[Reply to QMYSQL driver not loaded Error on Mon, 29 Oct 2018 12:07:38 GMT]]></title><description><![CDATA[<p dir="auto">i want to build the driver myself using this command:</p>
<pre><code>cd %QTDIR%\qtbase\src\plugins\sqldrivers
qmake -- MYSQL_INCDIR=C:/MySQL/include "MYSQL_LIBDIR=C:/MYSQL/MySQL Server &lt;version&gt;/lib/opt"
nmake sub-mysql
</code></pre>
<p dir="auto">my MySQL folder location is : C:\Program Files\MySQL<br />
so i use this code:<br />
qmake -- MYSQL_INCDIR=C:\Program Files\MySQL\MySQL Server 5.7/include "MYSQL_LIBDIR=C:\Program Files\MySQL\MySQL Server 5.7/lib/opt"<br />
but I Receive this error:</p>
<pre><code>library mysql not defined
</code></pre>
]]></description><link>https://forum.qt.io/post/489746</link><guid isPermaLink="true">https://forum.qt.io/post/489746</guid><dc:creator><![CDATA[rezaMSLM]]></dc:creator><pubDate>Mon, 29 Oct 2018 12:07:38 GMT</pubDate></item><item><title><![CDATA[Reply to QMYSQL driver not loaded Error on Mon, 29 Oct 2018 10:17:49 GMT]]></title><description><![CDATA[<p dir="auto">I Found this answer on web:</p>
<pre><code>When you download Qt you have also the source that are provided with it.

In my case, it is in : C:\Qt\5.9\Src\qtbase\src\plugins\sqldrivers\mysql Here you have a *.pro (that is a kind of makefile generator). You just have to open it with QtCreator, Compile it and you will get a dll. This dll is the MySQL driver and must be in the same dirent of your application.
</code></pre>
<p dir="auto">but when i want to compile the file I receive this error:</p>
<pre><code> Library 'mysql' is not defined.
</code></pre>
]]></description><link>https://forum.qt.io/post/489724</link><guid isPermaLink="true">https://forum.qt.io/post/489724</guid><dc:creator><![CDATA[rezaMSLM]]></dc:creator><pubDate>Mon, 29 Oct 2018 10:17:49 GMT</pubDate></item><item><title><![CDATA[Reply to QMYSQL driver not loaded Error on Mon, 29 Oct 2018 07:11:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dheerendra">@<bdi>dheerendra</bdi></a> said in <a href="/post/489676">QMYSQL driver not loaded Error</a>:</p>
<blockquote>
<p dir="auto">Do you have mysql plugin under plugins/sqldriver directory ?</p>
</blockquote>
<p dir="auto">is it a *.dll file?if yes , No thereis not any *.dll file in that directory</p>
]]></description><link>https://forum.qt.io/post/489681</link><guid isPermaLink="true">https://forum.qt.io/post/489681</guid><dc:creator><![CDATA[rezaMSLM]]></dc:creator><pubDate>Mon, 29 Oct 2018 07:11:55 GMT</pubDate></item><item><title><![CDATA[Reply to QMYSQL driver not loaded Error on Mon, 29 Oct 2018 06:48:23 GMT]]></title><description><![CDATA[<p dir="auto">Do you have mysql plugin under plugins/sqldriver directory ?</p>
]]></description><link>https://forum.qt.io/post/489676</link><guid isPermaLink="true">https://forum.qt.io/post/489676</guid><dc:creator><![CDATA[dheerendra]]></dc:creator><pubDate>Mon, 29 Oct 2018 06:48:23 GMT</pubDate></item></channel></rss>