[PyQt] QtSQL cant connect using MySQL driver

Phil Thompson phil at riverbankcomputing.com
Tue Sep 8 08:22:05 BST 2009

On Mon, 7 Sep 2009 15:44:54 -0700, Christian Caron <ccaron at fattoc.com>
> Phil has control over PyQt. I'm talking about compiling mysql support  
> into Trolltech's err I mean Nokia's Qt.

The PyQt installer includes a copy of Qt built with support for MySQL. It
requires the MySQL client libraries to be installed (unlike the PostgreSQL
support which is linked against static libraries).


> On Sep 7, 2009, at 3:39 PM, Scott Ballard wrote:
>> 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.
>> >Phil
>> 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)]
>>>> PYQT_VERSION_STR: 4.5.4
>>>> 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