Restore a single Mariadb / MySQL database from idb and frm files


Posted in Code, MySQL on Oct 03, 2018

I had a server running Mariadb or MySQL within Docker on top of Btrfs. It ran happily for a while, then got so monumentally corrupted that it was not possible to restore it. I could not dump the data from the docker container because it was impossible to start docker itself, but I was able to make a copy of the mysql directory, so once I had restored the server itself (nixops <3) I had to figure out how to restore the database. In the end, it turned out to be quite simple.

Get a mysql replication running again ASAP


Posted in Code, MySQL on Dec 17, 2014

Sometimes, mysql replication fails, because of network problems, a reboot or what have you. The fastest way to get it running again is often to reinitialise the data completely. Here is how to do that.