Docker Community Forums

Share and learn in the Docker community.

Docker Mysql not starting due to damaged tablespace

When testing Joomla a template with sample data has damaged one database.

After restart of the mysql container I get:

2020-11-28T23:20:58.906146Z 1 [ERROR] [MY-012209] [InnoDB] Multiple files found for the same tablespace ID:
2020-11-28T23:19:57.946063Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Failed, retry may succeed.
joomladb | 2020-11-28T23:19:57.946211Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
joomladb | 2020-11-28T23:19:57.946734Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
joomladb | 2020-11-28T23:19:57.946979Z 0 [ERROR] [MY-010119] [Server] Aborting
joomladb | 2020-11-28T23:19:57.947674Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.19) MySQL Community Server - GPL.
And Mysql is [ERROR] [MY-010119] [Server] Aborting and so does the container.

The underlying system is Ubuntu.

Is it possible to avoid the start of Mysql so that I can connect into Ubuntu and delete the failing database from var/lib/mysql ?

Otherwise the work of the whole day has passed away :face_vomiting:
Docker Desktop is running on a Windows 10 pro X64 System.

Any hints appreciated.


If you start the MySQL container with

docker container run --rm -it [ your config here ] mysql bash

you will have a shell in the container without a running database.

Good morning tekki,
your command worked an I could enter the container.
Unfortunately the /var/lib/mysql folder is empty.
I have made a backup before the problem ocurred with
docker run --rm --volumes-from joomladb -v joomladb:/backup white204/boh-repo:joomladb_28.11.20-22.19 tar cvf /backup/backup-joomladb_28.11.20-22.19.tar /var/lib/mysql

and wanted to restore the image with
docker run --rm --volumes-from joomladb -v joomladb:/backup white204/boh-repo:joomladb_28.11.20-22.19 bash -c “cd /var && tar xvf /backup/backup-joomladb_28.11.20-22.19.tar --strip 1”

but I get
tar: /backup/backup-joomladb_28.11.20-22.19.tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

I seems that I did not understand how docker volumes, backup and restore really work.

Nevertheless - Thank you very much for your help.

Have a nice day and take care

AI: The --volumes-from did the trick.
You are my hero for today!!

I thought you question is about repairing damaged tables and not about backup and restore. If this is the case, just mount your existing volume into the new container. You don’t give enough information about the setup of your system, but it’s probably -v joomladb:/var/lib/mysql.
To make a backup of your database don’t create tar files of the MySQL data directories, use a tool like mysqldump instead.

Dear tekki,

Yes - my primary goal was to get into the container which did not come up due to 2 mysql tablespaces with the same id.

After I did what you recommended first the /var/lib/mysql folder was empty and my first thought was that I made a mistake in the backup process.

But all was pretty after I passed the --volumes-from parm to the docker run command. I could delete one of the questionable databases from /var/lib/mysql directly and the container started again properly.

Since I am using docker I have had several times that changes I made disappeared when I started docker on the next day.

fyi: I am using Docker for the test environment for several homepages I am maintaining.

I have one container for the webserver and one separate for the database server.

I am using the Joomla CMS and it is vital that both match. For that reason the backup of databases only with mysqldump is not sufficient.

I tried to store the docker volumes on my Windows 10 system but that fails because the docker image uses Linux and the stupid Win does not support symlinks.
if I did not need to be compatible with others I would not be using Windows anymore.

Therefore I developed a Ruby script which does backups of both containers (with tar) with one click.

I run the script to backup and restore both containers every evening in order to avoid loss of changes.

I you have a better solution to keep and synchronize changes in both containers over docker restarts I would be glad to hear that.

Once again, thank you very much for your support. You saved me a lot of work!

Take care.