MySQL-python Windows 64bit and 32bit distributions

Last Updated on Sunday, 19 September 2010 05:15 Written by Ioannis Lalopoulos Wednesday, 22 April 2009 07:43

UPDATE 19/9/2010: for Python 2.7 look at this post.

I have built two 64bit and two 32bit Windows distributions of the MySQLdb module for Python 2.6.x for both the stable 1.2.2 and the beta 1.2.3c1 versions.

It seems there were no 64bit distribution for Windows (at least for Python 2.6.x) in public and some of the 32bit ones I have tried had not been built with charset support for languages like greek or hebrew (not that I need them since the encoding I use is utf-8).

You can download the distributions from here:

  MySQL-python-1.2.2.win32-py2.6.exe (1,022.8 KiB) (1.0 MiB)

  MySQL-python-1.2.3c1.win32-py2.6.exe (1,023.2 KiB) (1.0 MiB)

UPDATE – Embedded binaries also available:

For the 64bit embedded versions get: (261.0 KiB) (261.4 KiB)

For the 32bit embedded versions get:

  MySQL-python-embedded-1.2.2.win32-py2.6.exe (231.9 KiB)

  MySQL-python-embedded-1.2.3c1.win32-py2.6.exe (232.3 KiB)

The embedded versions are linked against libmysqld.dll which must be present in the program directory (you will get a dll load fail if it isn’t there) and the share directory must also exist or else the program will crash in MySQLdb.server_init().


  1. David Woods   |  Thursday, 23 April 2009 at 00:12

    Have you had any luck building Windows distributions that use embedded MySQL? I have not been able to get this to work since the combination of MySQLdb 1.2.0 and MySQL 4.0.25. Any help you could provide would be greatly appreciated.

  2. Ioannis Lalopoulos   |  Thursday, 23 April 2009 at 23:38

    Never tried the embedded build until now.

    The news are good, I just made two succesfull 64bit builds of the embedded server (libmysqld.dll) and finished some tests.

    The build environment consisted of Windows Vista Business 64bit SP1, Python 2.6.2 x64, MySQL 5.1.33 x64, VS2008 Pro SP1 and MySQL-python 1.2.3c1 and 1.2.2.

    I have updated my original post with these 64bit builds and this Saturday will add the 32bit versions.

  3. Nicolas Steinmetz   |  Monday, 11 May 2009 at 16:21

    Thanks for this, I was on the way to start a VM just for this. You saved me a lot of time :)

  4. Christian   |  Saturday, 04 July 2009 at 08:21

    Thanks a lot for these! A real lifesaver, Python 2.6 + MySQL on Windows used to be a real pain until I saw this post.


  5. Arend   |  Saturday, 04 July 2009 at 21:03

    Great – I wish I found this site half a day earlier.
    Thanks a lot

  6. Antonio   |  Wednesday, 08 July 2009 at 23:31

    Thank you for sharing your work!

  7. MySQL-python Windows 64bit and 32bit distributions | Python Developer India   |  Friday, 10 July 2009 at 18:25

    [...] Read more from the original source: MySQL-python Windows 64bit and 32bit distributions [...]

  8. AD   |  Saturday, 01 August 2009 at 11:38

    Can you give some help on getting the installer to see the registry path for Python? I’ve checked, its there, but the installer can’t see it.


  9. Tugba   |  Tuesday, 04 August 2009 at 22:30

    Hi Ioannis, thank you for sharing this great work!

    I was searching for an embedded MySQL and found your great blog. I really need your help.. Do you have a distribution for win32 & Python 2.5?

  10. Scott Turnbull   |  Monday, 17 August 2009 at 21:06

    This was a real lifesaver. I have had the hardest time getting the library compiled on Windows for use with Python 2.6 and this worked fined. Thanks again.

  11. Matt   |  Wednesday, 19 August 2009 at 17:58

    Hey I noticed that I get a Warning when using the module:

    Warning (from warnings module):
    File “C:\Python26\lib\site-packages\MySQLdb\”, line 34
    from sets import ImmutableSet
    DeprecationWarning: the sets module is deprecated

    Not a big deal, just a heads up for anyone on python 2.6. I was getting really frustrated with mysql-python until I found this! Great work.

  12. mg   |  Tuesday, 25 August 2009 at 21:45

    спасибо мужик :)

  13. Sylvain   |  Monday, 07 September 2009 at 12:49

    This is really helpful, thanks a ton.

  14. André Lucas   |  Tuesday, 15 September 2009 at 22:16

    Thanks so much, this has really helped me out.

  15. Robert Krolik   |  Friday, 02 October 2009 at 18:09

    Thanks a lot :) Great job

  16. David Marble   |  Friday, 02 October 2009 at 20:58

    If you’re on Windows (I’m using Windows 7 64-bit) and get the error that python version 2.6 is not found in the registry (might just be a problem with ActiveState), just manually add the registry keys so this exists:


    Then change the value of (Default) under that key to “C:\python26″ or your own path\to\python2.6

    Installation of the above files should work then.

  17. Stig Mattsson   |  Saturday, 10 October 2009 at 20:20

    Thank you, David, for your comments on the 64-bit issue, it has really been helpful.

  18. Josh   |  Sunday, 18 October 2009 at 02:58

    Thanks a lot for help!

  19. Thomas   |  Sunday, 25 October 2009 at 20:25


    I’m trying to get Py 2.6 and Mysql running on a windows 7 (64-Bit) system.
    It works fine – thanx a lot!

    The only problem I experienced is the following:
    The installer stops with windows exception (I don’t know how to call it) if I don’t use the predefined path. (I tried the “german” path c:\programme\python26

    Any ideas?


  20. Dorrith Pennink   |  Wednesday, 04 November 2009 at 14:00

    I am running under vista 64, I’ve installed mysql but running my python file i get this errormessage:

    from MySQLdb import connect
    File “C:\Python26\lib\site-packages\MySQLdb\”, line 19, in
    import _mysql
    ImportError: DLL load failed: %1 is geen geldige Win32-toepassing.

    Any suggestions how to avoid this? Thanks

  21. YiXia   |  Tuesday, 10 November 2009 at 04:47

    thanks a lot with tears
    you are so great!!

  22. Anthony Leotta   |  Friday, 27 November 2009 at 07:31

    Can you run MySQL-python-1.2.3c1.win32-py2.6.exe and MySQL-python-embedded-1.2.3c1.win32-py2.6.exe side by side?

    if so how?

    I tried and it didn’t seem to work.

  23. Helen Dangote   |  Friday, 25 December 2009 at 03:02

    Thanks for this awesome piece of software. I was having problems connecting to MySQL with Python till I found your site.

    Thanks for the nice job.

  24. Christopher Mahan   |  Monday, 04 January 2010 at 03:04

    Thanks! That’s exactly what I needed!

  25. Denis Ignatovich   |  Tuesday, 05 January 2010 at 15:08

    thank you, this is great

  26. Frustrated Coder   |  Tuesday, 26 January 2010 at 05:31


    I just wasted four hours of my life trying to get Visual C and mingw and distutils and Python to all play nicely on 64bit Vista. And then I spent all of thirty seconds clicking next and install in your application.

    Thanks again!

  27. Brian   |  Monday, 01 February 2010 at 03:52

    Thanks for providing these. Saved me much time with a Windows installation of a Django web site.

  28. ZOMGWHY   |  Tuesday, 02 February 2010 at 22:49

    When i try using the “”, the installer freezes during setup and I don’t know why. I am using Python 2.6.4 64-bit on windows 7 64-bit.

    Thank you.

  29. Tupteq   |  Thursday, 04 February 2010 at 16:40

    God bless you for this builds. There are good people on this world :)

  30. Hongwu   |  Friday, 05 February 2010 at 16:07

    Thanks for the build and the tip for windows 7 64 bit. I am also trying to run Django but keep getting “Error loading MySQLdb module: DLL load failed with error code 193″. I have tried to put the DLL file in the python directory and my project directory and the mysqlDB package directory but no lucky. Could you suggest me what does “program directory” exactly mean?
    Thanks in advance.

  31. TxRx   |  Wednesday, 17 March 2010 at 14:54

    You may want to amend the path extensions search pattern environment variable:


    Like so.

  32. TxRx   |  Wednesday, 17 March 2010 at 14:57

    Oh and by the way. Thank you for your superb compilation of this most needed binary on x64!!!

    Live saver man, blooming life saver.

  33. Adam   |  Thursday, 01 April 2010 at 06:33

    Thank you for this. Saved me time and frustration.

  34. Chinese   |  Friday, 09 April 2010 at 05:36

    think you

    windows python+mysql



  35. giunghi   |  Friday, 09 April 2010 at 11:25

    Sorry for the question but I am not a real expert. What is the difference between the version with embedded binaries and the simple one? I don’t have the libmysqld.dll in my python 2.6 directory. can someone help? many thanks, giunghi

  36. Filip   |  Friday, 09 April 2010 at 19:42

    If you are getting the setup to freeze or possibly an error message when installing on a Windows 7 system: you need to right click the setup file and click “Run as administrator”. Then it should be installed correctly.

    Good luck! :)

  37. Sam   |  Saturday, 10 April 2010 at 01:12

    Thank you so much!

  38. Amin   |  Monday, 10 May 2010 at 23:40

    love u man, thanks u saved my day! i really needed it ASAP ! and u helped me alot! installing it manually didnt work …

    thank you again.

  39. Mick   |  Monday, 17 May 2010 at 19:52

    Excellent resource – thanks.

    One note for anyone using Python 2.6 and py2exe:

    If you use version 1.2.2 above (e.g. MySQL-python-1.2.2.win32-py2.6.exe) you will get an warning from py2exe that sets has been deprecated. This seems to cause odd bugs which can prove tricky to trace back to this warning – for example we had an app which ran fine from the command line (i.e. python and seemed to run fine when built into an application with py2exe, but then hung when quitting with an error which seemed to imply an interaction issue between wx and twisted.

    Moving to 1.2.3c above (e.g. MySQL-python-1.2.3c1.win32-py2.6.exe) causes the warning to disappear (as the built in alternative to sets in Python 2.6 is used) and caused the problem to disappear (in our app anyway).

    So if you are using Python 2.6 it may be that 1.2.3c is a better choice despite the ‘beta’ tag.

  40. AbdallahD   |  Saturday, 22 May 2010 at 15:37

    Thanks a lot for this, you saved me plenty of time!

  41. Peter   |  Friday, 28 May 2010 at 03:28

    Amazing–thanks so much!


  42. victor jabur   |  Sunday, 30 May 2010 at 04:38

    I wrote this post, teaching how to build and install the MySQLdb on Windows ! I hope this post help someone.

    Victor Jabur

  43. jhg   |  Wednesday, 07 July 2010 at 23:17

    Will MySQL-python work with Python 3.1?

  44. Don Key   |  Friday, 16 July 2010 at 18:50

    Any chance there will be an EXE build to support Python 2.7?

  45. chodorowicz   |  Friday, 23 July 2010 at 13:33

    thanks for this packages, but I think these won’t work with Django 1.2.1 – I get the following error after install

    django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: this is MySQLdb version (1, 2, 3, ‘final’, 0), but _mysql is version (1, 2, 2, ‘final’, 0)

    I suppose that this branch of Django needs MySQLdb in version 1.2.3 final. Could you provide a final build of 1.2.3 ?

    Thanks in advance

  46. chodorowicz   |  Friday, 23 July 2010 at 13:39

    sorry, it was supposed to be “Django 1.1.2 final”

  47. chodorowicz   |  Friday, 23 July 2010 at 16:11

    OK, my third comment – sorry, everything works good – I’ve been after installing dozens of different versions of mysql-python and I’ve left one by accident in my project folder

    Thanks for the complied versions (I just could’t compile it myself on Win7x64, both with VC++ Express and MinGW)

  48. Microkernel   |  Thursday, 12 August 2010 at 21:29

    Python 2.7?

  49. Govind Kelkar   |  Friday, 03 September 2010 at 07:34

    Victor your blog did helped me in setting up MySQLdb for python 2.7. Though I do not know the content language of your blog but the keywords did helped a lot.


  50. Rinze   |  Thursday, 21 October 2010 at 14:51

    This might be a long shot, but maybe someone reading this can point me in the right direction.

    I’m trying to build Mysql-python 1.2.3 for Python 2.5 under Windows 7. I’m using MS Visual C++ 2003 from the command line for this.

    When I use ‘ bdist_wininst’, the code compiles just fine but after that the linker fails with a bunch of ‘unresolved external symbol’ errors. To resolve these errors I added (hard coded) the ‘zlib’, ‘msvcrt’, ‘libmysql’ libraries to Mysql-python’s ‘’, which already had ‘kernel32′, ‘advapi32′, ‘wsock32′ and ‘mysqlclient’ defined.

    When I try to build now, I end up with a working installer.

    However, the resulting _mysql.pyd is only 44Kb large (way smaller than others I’ve seen from built packages) and it only works when it can find libmySQL.dll. Also, when I check _mysql.pyd’s dependencies, I see that they differ from others.

    Mine depends on libmysql.dll, msvcr71.dll, python24.dll and kernels32.dll, while others typically depend on python25.dll, kernel32.dll, advapi32.dll and wsock32.dll.

    So, somewhere along the line the dependencies get screwed up and I think that some code that needs to be included within the _mysql.pyd doesn’t end up there (resulting in the smaller size and dependency of an external libmysql.dll)

    Anyone got any ideas?

  51. Rinze   |  Thursday, 21 October 2010 at 23:06

    A little update about my post: where I wrote python24.dll, it should say python25.dll

    Also, after writing I found your post on the x64 build you made of Mysql-python 1.2.2 for python2.5. It seems to have the same dependencies as my build, including the need for the dynamically linked libmysql.dll.

    The weird thing is still that I also have a x32 build of Mysql-python 1.2.2 for python 2.5, which does not depend on an external libmysql.dll. I’m going to try and get a hold of the guy who built that one.

  52. Rinze   |  Friday, 22 October 2010 at 12:21

    Got it resolved. The trick was to download Mysql C connector’s source code and build that using Visual Studio 2003. The resulting mysqlclient.lib make the last linking errors go away.

    All unit tests passed, except two, which were due to un-configured permissions.

    The only difference now is that _mysql.pyd depends on ws2_32 instead of wsock32, but that shouldn’t give any problems.
    For anyone interested, the installer MySQL-python-1.2.3.win32-py2.5.exe can be found here:

    Use at own risk though :)

  53. saber7   |  Tuesday, 14 December 2010 at 10:35

    nice job:D
    thnx very much for this.

  54. Anton   |  Saturday, 15 January 2011 at 18:06

    Thank you man, I’m sick already of mac/linux centric pythonistas, you’ve made my day.

  55. Kosei Kitahara   |  Saturday, 26 February 2011 at 11:23

    Awesome! Thank you so much!

  56. Timm   |  Sunday, 27 March 2011 at 08:59

    Amazing, a real timesaver!! THX a lot!

  57. yuxc   |  Thursday, 14 April 2011 at 11:45

    Thx very very much!I just want to give it up….

  58. Anoop MS   |  Friday, 18 November 2011 at 17:38


    I dont have a visual studio to compile the code. This helped me a lot.


  59. Bill   |  Monday, 14 May 2012 at 18:07

    When I try to run either or, the installation program says “Python 2.6 required for this package, which was not found in registry”, even though the Registry lists Python/PythonCore as 2.6. It then asks me to select a Python istallation, but the list is empty.

  60. Geodexter   |  Saturday, 29 September 2012 at 03:02

    I use arcpy 10.0 and tied to python 2.6.
    Found this page after a lot of searching, gonna tweet your link!

Leave a Reply