docker安装mysql 8

工具

通过docker 安装 mysql 8

# docker 中下载 mysql docker pull mysql #启动 docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=Yxf2331122! -d mysql #进入容器 docker exec -it mysql bash #登录mysql mysql -u root -p ALTER USER 'root'@'localhost' IDENTIFIED BY 'Yxf2331122!'; #添加远程登录用户 CREATE USER 'styleyan'@'%' IDENTIFIED WITH mysql_native_password BY 'Yxf2331122!'; GRANT ALL PRIVILEGES ON *.* TO 'styleyan'@'%';