docker安装mysql,设置mysql初始密码

docker安装mysql,只需要2分钟就可以完成

docker search mysql 

docker安装mysql,设置mysql初始密码插图

拉取mysql镜像(https://hub.docker.com/_/mysql

docker pull mysql:5.7 

官网可查看存在的镜像,以及需要的版本号

docker安装mysql,设置mysql初始密码插图1

运行mysql(–name 容器名称 -e MYSQL_ROOT_PASSWORD设置初始密码 -p 3307:3306 端口映射,主机端口3307)

docker run --name mysql5.7 -e MYSQL_ROOT_PASSWORD=123456 -p 3307:3306 -d mysql:5.7 

连接mysql

[root@bogon ~]# docker exec -it mysql5.7 bash root@9e1dcf8298ce:/# mysql -u root -p 

docker安装mysql,设置mysql初始密码插图2

mysql日志查看

docker logs mysql5.7 

原文链接:https://blog.csdn.net/m0_67403272/article/details/126327494?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522168994674516800182116245%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=168994674516800182116245&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-27-126327494-null-null.268%5Ev1%5Ekoosearch&utm_term=docker%E3%80%81wordpress%E3%80%81wordpress%E5%BB%BA%E7%AB%99%E3%80%81wordpress%E4%B8%BB%E9%A2%98%E3%80%81%E5%AE%B9%E5%99%A8%E9%95%9C%E5%83%8F%E3%80%81

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享