Docker 安装 MySQL8

Docker 中下载MySQL

docker pull mysql

启动,设置时区

docker run --name docker-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -e TZ=Asia/Shanghai -d mysql 

进入容器

docker exec -it mysql bash

登录mysql

mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

添加远程登录用户

CREATE USER 'supermingjun'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'supermingjun'@'%';
posted @ 2020-06-10 17:23  supermingjun  阅读(129)  评论(0编辑  收藏