MySQL-python Windows 64bit and 32bit distributions

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)

  MySQL-python-1.2.2.win-amd64-py2.6.exe (1.0 MiB)

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

  MySQL-python-1.2.3c1.win-amd64-py2.6.exe (1.0 MiB)

UPDATE – Embedded binaries also available:

For the 64bit embedded versions get:

  MySQL-python-embedded-1.2.2.win-amd64-py2.6.exe (261.0 KiB)

  MySQL-python-embedded-1.2.3c1.win-amd64-py2.6.exe (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().

60 comments on “MySQL-python Windows 64bit and 32bit distributions

Comment navigation

  • 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.

    Reply
  • Ioannis Lalopoulos says:

    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.

    Reply
  • 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.

    Thanks

    Reply
  • 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?

    Reply
  • Scott Turnbull says:

    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.

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

    Warning (from warnings module):
    File “C:\Python26\lib\site-packages\MySQLdb\__init__.py”, 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.

    Reply
  • 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:

    HKLM\Software\Python\PythonCore\2.6\InstallPath

    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.

    Reply
  • Hello,

    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?

    Thomas

    Reply
  • Dorrith Pennink says:

    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\__init__.py”, line 19, in
    import _mysql
    ImportError: DLL load failed: %1 is geen geldige Win32-toepassing.

    Any suggestions how to avoid this? Thanks

    Reply
  • Anthony Leotta says:

    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.

    Reply
  • Frustrated Coder says:

    OMG I LOVE YOU. THANK YOU SO MUCH.

    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!

    Reply
  • When i try using the “MySQL-python-1.2.2.win-amd64-py2.6.exe”, 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.

    Reply
  • 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.

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

    set PATHEXT=%PATHEXT%;.DLL

    Like so.

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

    Live saver man, blooming life saver.

    Reply
  • giunghi says:

    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

    Reply
  • 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! 🙂

    Reply
  • 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.
    respect

    Reply
  • 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 myapp.py) 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.

    Reply
  • 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

    Reply
  • 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)

    Reply
  • Govind Kelkar says:

    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.

    Regards,
    Govind

    Reply
  • 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 ‘setup.py 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 ‘setup_windows.py’, 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?

    Reply

Comment navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.