docker部署mysql问题汇总

docker-compose 配置 version: '3' services: # mysql blog_mysql: image: mysql restart: always ports: - '3306:3306' environment: - MYSQL_ROOT_PASSWORD=xxxx volumes: - '/data/mysql:/var/lib/mysql' docker 安装完mysql 后客户端无法访问 进入镜像中的mysql docker exec -it container_id /bin/bash 登录mysql mysql -u root -p 修改root账号, 可以通过任何客户端连接 ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'xxxxx';

May 9, 2020 · 1 min · zakudriver