Tuesday, March 12, 2013

New in 5.6: --innodb_read_only, running MySQL from DVD

I recently met two distinct customers who want to use MySQL as a read-only database, stored on a read-only medium like a DVD. With MyISAM this was easily possible. Starting with MySQL 5.6 it is also possible to run this setup with InnoDB based databases. There is a new option:

   --innodb_read_only

See details in the reference manual. This options opens all tablespaces and InnoDB log files as read-only. A small test showed that you need to set some more options in the my.cnf to avoid any write access to @@datadir:

innodb-read-only
log-error=/tmp/mysql-ro.err
pid-file=/tmp/mysql-ro.pid
event-scheduler=disabled

I was a bit surprised why I had to disable the event scheduler. But on the other hand, what use has a regularly running statement that cannot store any data? After all your database is read only ;-)

And together with the new fulltext indexes in InnoDB and maybe compressed table spaces you can now deploy catalogue applications or reference manuals on DVD.