<?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[[MySQL][ODBC 8.0(w) Driver] Can&#x27;t connect to MySQL server on &#x27;localhost&#x27; (10061) QODBC3: Unable to connect&quot;]]></title><description><![CDATA[<p dir="auto">Hi!..</p>
<p dir="auto">I have installed a Windows computer having MariaDB installed, its ip is 192.168.1.200, now I'm trying to connect through another computer on the same LAN, the ODBC connector on Data Sources (Windows) test connection successfuly so driver is working fine...</p>
<p dir="auto">Tried this example to test the remote connection:</p>
<pre><code>int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QSqlDatabase db = QSqlDatabase::addDatabase("QODBC3");
    db.setDatabaseName("Driver={MySQL ODBC 8.0 Unicode Driver};Database=db0");
    db.setPort(3306);                                     //Update: this has no effect
    db.setHostName("192.168.1.200");   //Update: this has no effect
    db.setUserName("root");         
    db.setPassword("$$Mas7eR");
    
    if (!db.open()) qDebug() &lt;&lt; db.lastError().text();
    
    else {
        qDebug() &lt;&lt; "Success!";
        db.close();
    }
    return a.exec();
}
</code></pre>
<p dir="auto">Output is:<br />
<strong>[MySQL][ODBC 8.0(w) Driver] Can't connect to MySQL server on 'localhost' (10061) QODBC3: Unable to connect"</strong></p>
<p dir="auto">I'm a bit confused why is it claiming for localhost if I setup 192.168.1.200<br />
Any help?.. Thanks so much in advance.</p>
<hr />
<p dir="auto"><strong>Update</strong> :<br />
I have noticed that setPort and setUserName had no effect, is more like those values are being overwritten from somewhere... that's why output points to localhost rather than server ip....  I say this because I have tested the same example on the server itself with loopback and worked, then changed the setHostName to 10.0.1.1 (a random ip) and worked again.. ...</p>
]]></description><link>https://forum.qt.io/topic/111952/mysql-odbc-8-0-w-driver-can-t-connect-to-mysql-server-on-localhost-10061-qodbc3-unable-to-connect</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 16:31:02 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/111952.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 24 Feb 2020 22:43:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [MySQL][ODBC 8.0(w) Driver] Can&#x27;t connect to MySQL server on &#x27;localhost&#x27; (10061) QODBC3: Unable to connect&quot; on Tue, 25 Feb 2020 22:01:37 GMT]]></title><description><![CDATA[<p dir="auto">Great !</p>
<p dir="auto">Then please mark the thread as solved so other forum members may know a solution has been found :-)</p>
]]></description><link>https://forum.qt.io/post/579657</link><guid isPermaLink="true">https://forum.qt.io/post/579657</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 25 Feb 2020 22:01:37 GMT</pubDate></item><item><title><![CDATA[Reply to [MySQL][ODBC 8.0(w) Driver] Can&#x27;t connect to MySQL server on &#x27;localhost&#x27; (10061) QODBC3: Unable to connect&quot; on Tue, 25 Feb 2020 21:10:54 GMT]]></title><description><![CDATA[<p dir="auto">you're absolutely right,... this is the string that worked for me:</p>
<pre><code>QString connection_string = 
"Driver={MySQL ODBC 8.0 Unicode Driver};"
"Server=192.168.1.200, 3306;"
"Database=db0;"
"Uid=root;"
"Pwd=$$Mas7eR";
"MULTI_HOST=1;");

db.setDatabaseName(connection_string);
</code></pre>
<p dir="auto">Thanks.</p>
]]></description><link>https://forum.qt.io/post/579655</link><guid isPermaLink="true">https://forum.qt.io/post/579655</guid><dc:creator><![CDATA[U7Development]]></dc:creator><pubDate>Tue, 25 Feb 2020 21:10:54 GMT</pubDate></item><item><title><![CDATA[Reply to [MySQL][ODBC 8.0(w) Driver] Can&#x27;t connect to MySQL server on &#x27;localhost&#x27; (10061) QODBC3: Unable to connect&quot; on Tue, 25 Feb 2020 20:38:52 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am by no means an ODBC expert but I think you have to pass that information through the connection string.</p>
<p dir="auto">See <a href="https://wiki.qt.io/ODBC" target="_blank" rel="noopener noreferrer nofollow ugc">here</a>.</p>
<p dir="auto">It's also explained in the <a href="https://doc.qt.io/qt-5/sql-driver.html#qodbc" target="_blank" rel="noopener noreferrer nofollow ugc">Qt ODBC driver documentation</a>.</p>
]]></description><link>https://forum.qt.io/post/579650</link><guid isPermaLink="true">https://forum.qt.io/post/579650</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 25 Feb 2020 20:38:52 GMT</pubDate></item></channel></rss>