Docker启动mysql失败

现象

docker启动mysql失败,报错docker exec -it mysql mysql -uroot -proot
Error response from daemon: Container 0f83eee59a75595deedecbd40b384333e6db35edd90c5d4c3a0eb3212f2e4665 is restarting, wait until the container is running
一直显示正在重启

解决

使用docker logs --tail 50 --follow --timestamps ID/NAME命令,根据id号查看错误日志定位原因,发现日志报错

2022-06-10T16:40:18.022297089Z 2022-06-10 16:40:17+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.36-1debian10 started.
2022-06-10T16:40:18.089266142Z 2022-06-10 16:40:18+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
2022-06-10T16:40:18.089293382Z  command was: mysqld --verbose --help --log-bin-index=/tmp/tmp.nwVhNzo5Rx
2022-06-10T16:40:18.089301169Z  2022-06-10T16:40:18.059605Z 0 [ERROR] COLLATION 'utf8_unicode_ci' is not valid for CHARACTER SET 'latin1'
2022-06-10T16:40:18.089308353Z 2022-06-10T16:40:18.066793Z 0 [ERROR] Aborting

在这里插入图片描述
问题在于mysqld在试图检查配置时失败。检查mysql的配置文件信息即可


版权声明:本文为qq_43124803原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。