mysql – Haskell language bindings for MySQL

This library provides low-level native Haskell bindings for the popular MySQL database. The bindings are written in pure Haskell, and do not use the Foreign Function Interface.

Why another library?

There already exists another MySQL client library, hsql-mysql. That library uses MySQL AB’s client library, and hence is subject to the terms of either the GNU General Public License or MySQL’s commercial license. (The hsql-mysql page states that it is BSD-licensed, but this is incorrect.)

In addition, because this library is written in pure Haskell, it opens up some interesting possibilities not open to other MySQL bindings. Watch this space for details.


This library is licensed under the BSD license.


Note: This library is under heavy development, and has not yet reached an official release milestone.

The library can currently talk successfully to MySQL 4.1 servers. It is not yet by any means fully featured.


The darcs repository is available from here:

darcs get

I’ve submitted some patches to Dominic for the Haskell Crypto library, which this library uses for password authentication. Until Dominic takes my patches, you’ll also need my modified tree:

darcs get
4 comments on “mysql – Haskell language bindings for MySQL
  1. jess says:

    seems you also need the darcs version of binary, to get getLazyByteStringNul

  2. kefer says:

    Looks like the bindings are no longer at Neither is the crypto library. What happened?

  3. Andrew says:

    Hi Bryan,

    I’ve been doing the same thing for Scheme, specifically for Gambit and it’s turning out to be a painful exercise.

    I’m guessing that you are using

    as your main source of reference ? Have you noticed that there are quiet a few omissions and ambiguities in that document ? I find that I’m constantly having to refer to the C or Java interface to try and work out what’s going on.

    So far I’ve got authentication working (new and old methods), dynamic queries, updates and result sets. I haven’t done binary data yet but have started on prepared statements. I’m not planning on doing compression or SSL support at this stage.

    How are you getting on ? Good luck – there are very few socket level clients knocking around.



  4. So far, I’ve been reading the C source, for exactly the reasons you mention. But I haven’t worked on this in perhaps a year now, and the code is still incomplete.

Leave a Reply

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