docker 安装mysql8
不废话,上命令
1. docker pull mysql:latest2. docker run -it --name mysql -v /home/mysql/conf:/etc/mysql/conf -v /home/mysql/log:/var/log/mysql -v /home/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=1234 -p 3306:3306 mysql:latest3. docker ps # 查看运行状态4. docker logs -f mysql # 查看运行日志
坑
1. docker权限不足
错误信息:[Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.[Note] [Entrypoint]: Switching to dedicated user 'mysql'[Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.ls: cannot access '/docker-entrypoint-initdb.d/': Operation not permitted
docker 没有足够的权限访问文件,只需要在docker run上加上 --privileged问题即可解决
参考链接
2. 进入mysql服务Access Denied
傻逼了,写文章之前2小时一直出现这个问题,写的时候要素材,直接给好了,淦
来源地址:https://blog.csdn.net/CM_Benny/article/details/127024735