[PyQt] QtSQL cant connect using MySQL driver

Scott Ballard scott at scottballard.net
Mon Sep 7 23:39:27 BST 2009

According to Phil, he added MySQL support to the last build...

 >>I'm just wondering why the MySQL drivers can't be compiled into the 
PyQt Windows binary installer, instead we have to compile our own 
Qt/PyQt with the >>MySQL and/or PostGres drivers.
 >They are in the current installers (for Python v2.6 and v3.1). I'm not
 >updating the installer for Python v2.5.


Christian Caron wrote:
> By default, QtSql does't have support for mysql. You have to compile 
> it by specifying the right options when ./configuring Qt for build.
> Christian
> On Sep 7, 2009, at 3:29 PM, Scott Ballard wrote:
>> Hey list,
>> Sorry to ask about this again, but I never got it working and was 
>> pulled off onto something else. Now I have time to look into it again.
>> I can't seem to get the qmysql driver to work with the QtSQL module 
>> in PyQt 4.5.4 and Python 2.6.2 on Windows XP SP2.
>> What exactly is required to make a connection to a MySql database 
>> from PyQt? I have Wamp installed, running MySql and am able to 
>> connect to it using the MySQLdb module.
>> The qmysql4.dll is in the 
>> Python26\Lib\site-packages\PyQt4\plugins\sqldrivers.
>> Here's the important output:
>> 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)]
>> QSqlDatabase: QMYSQL driver not loaded
>> QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC QPSQL7 QPSQL
>> Has anyone gotten this working? Are there any 3rd party DLLs that 
>> need to be installed? Any hints would be welcome!
>> Cheers,
>> -Scott
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

More information about the PyQt mailing list