Mysql – How to set up thesql docker container with existing ib* files

dockeribdataMySQLmysql-5.1recovery

Related to a previous issue, I'm trying to recover some data from existing ib* files from a crashed server. The database version is 5.1.69, so quite old. One of the responses was to install MySQL 5.5, because it should still be able to import 5.1, but even that is too old on current systems, and one just runs into ever deeper compatibility issues.

“NBK” in the same issue suggested in a comment to use a docker file with an older version of MySQL. I decided to try this approach. I was able to install docker and pull the vsamov/mysql-5.1.73 image, but I'm stuck now at how to get the ib* files into the docker container.

I think I need the image to run so that it has a container ID, but if it's running, then the ib* files are locked, so I'm not sure how to proceed. If anyone has experience in this, or can provide a reference, it would be much appreciated.

Best Answer

ib* locked is another process already is running on them.

Restore the entire datadir, not just the ib* data files, to a directory.

Use the volume mount option of the container with docker/podman -v localdir:/var/lib/mysql option on the startup to pass that data directory to the container.