Backend for the persistent library using MySQL database server.

Version on this page:2.6@rev:2
LTS Haskell 22.26:
Stackage Nightly 2024-06-22:
Latest on Hackage:

See all snapshots persistent-mysql appears in

MIT licensed by Felipe Lessa, Michael Snoyman
Maintained by Felipe Lessa
This version can be pinned in stack with:persistent-mysql-2.6@sha256:58089479bffd093a76438ed244837a885f9b0a78fa814c92d3a6aad86ed3d206,2055

Module documentation for 2.6

This package contains a backend for persistent using the MySQL database server. Internally it uses the mysql-simple and mysql packages in order to access the database.

This package supports only MySQL 5.1 and above. However, it has been tested only on MySQL 5.5. Only the InnoDB storage engine is officially supported.

Known problems:

  • This package does not support statements inside other statements.



Compatibility for backend-specific upsert functionality. A lucky contributor could add upsert to the MySQL backend now, i.e.: INSERT … ON DUPICATE …


  • changes for read/write typeclass split

Support usign default= for changing the id field type


  • Distinguish between binary and non-binary strings in MySQL #451
    • Previously all string columns (VARCHAR, TEXT, etc.) were being returned from Persistent as PersistByteStrings (i.e. as binary data). Persistent now checks character set information to determine if the value should be returned as PersistText or PersistByteString.
    • This is a breaking change if your code is relying on a PersistByteString being returned for string-like MySQL values; persistent-mysql itself had several runtime errors that needed to be fixed because of this patch. High-level code dealing purely with PersistEntities should be unaffected.


  • Update to persistent 2.2


  • Added a Show instance for MySQLConf.

Documentation typo fix


Provide a FromJSON instance for MySQLConf.