[转]Docker启动mysql8.0版本自动退出,Supplied value : /var/lib/mysql-files(转载请删除括号里的内容)
(转载请删除括号里的内容)[root@xiao /]# docker run -d -p 3306:3306 -v /mydata/mysql/log:/var/log/mysql -v /mydata/mysql/data:/var/lib/mysql -v /mydata/mysql/conf:/etc/mysql -e MYSQL_ROOT_PASSWORD=root --name mysq
·
(转载请删除括号里的内容)
[root@xiao /]# docker run -d -p 3306:3306 -v /mydata/mysql/log:/var/log/mysql -v /mydata/mysql/data:/var/lib/mysql -v /mydata/mysql/conf:/etc/mysql -e MYSQL_ROOT_PASSWORD=root --name mysql mysql
a0cb6c6bf60baa45a79da19fee048b680cf306b4b4ed47b7bf05e693f52b759a
You have new mail in /var/spool/mail/root
[root@xiao /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a0cb6c6bf60b mysql "docker-entrypoint.s…" 4 seconds ago Exited (1) 2 seconds ago mysql
[root@xiao /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
发现容器自动退出
查看日志:docker logs mysql
[root@xiao /]# docker logs mysql
2022-03-20 03:51:20+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
2022-03-20 03:51:20+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-03-20 03:51:20+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
mysqld: Error on realpath() on '/var/lib/mysql-files' (Error 2 - No such file or directory)
2022-03-20T03:51:21.229669Z 0 [ERROR] [MY-010095] [Server] Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/lib/mysql-files
2022-03-20T03:51:21.229698Z 0 [ERROR] [MY-010119] [Server] Aborting
发现,日志报错,没有一个/var/lib/mysql-files挂载的真实路径
mysqld: Error on realpath() on '/var/lib/mysql-files' (Error 2 - No such file or directory)
解决方法:添加一个对应的宿主机路径,在重新启动前,记得删除已经存在的容器
-v /mydata/mysql/mysql-files:/var/lib/mysql-files
这是本人成功截图
[root@xiao /]# docker run -d -p 3306:3306 -v /mydata/mysql/log:/var/log/mysql -v /mydata/mysql/data:/var/lib/mysql -v /mydata/mysql/conf:/etc/mysql -v /mydata/mysql/mysql-files:/var/lib/mysql-files -e MYSQL_ROOT_PASSWORD=root --name mysql mysql
83147b6cb0ff24d18ff5737a75b02ec33daa91a0556b72774ef84150abc5ad06
[root@xiao /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
83147b6cb0ff mysql "docker-entrypoint.s…" 3 seconds ago Up 2 seconds 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql
---------------------
作者:终是庄周梦了蝶_G
来源:CSDN
原文:https://blog.csdn.net/crazySlayer/article/details/123610392
版权声明:本文为作者原创文章,转载请附上博文链接!
内容解析By:CSDN,CNBLOG博客文章一键转载插件
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献5条内容
所有评论(0)