Docker Community Forums

Share and learn in the Docker community.

MySQL container failed to start because of locked privilege table

This probably isn’t the right spot for this, but I did find a solution for this and wanted to share.

As the title says, the pretty much default container from the image was failing to start after docker compose pulled. I had it set for 5.7, so when troubleshooting I changed it to 5.7.34, then 5.7.32 and 5.7.29 which didn’t help.

The log message I was getting

2021-06-23T14:15:43.236845Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.columns_priv' doesn't exist
2021-06-23T14:15:43.236873Z 0 [ERROR] Fatal: can't initialize grant subsystem - 'Table 'mysql.columns_priv' doesn't exist'
2021-06-23T14:15:43.236885Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2021-06-23T14:15:43.236973Z 0 [ERROR] Aborting

Removing the container and images didn’t help, but removing the volume is what ended up saving my bacon.

The commands which saved me, find your mysql volume and remove it:

$ docker volume ls
DRIVER    VOLUME NAME
local     myapp_bundle
local     myapp_mysql
local     myapp_rails_cache
local     myapp_redis
$ docker volume rm myapp_mysql

Then bringing the app up (docker-compose run) worked perfect. Not sure what happened, but couldn’t find much with searching and just wanted this out there somewhere.