1.创建mysql容器
拉取容器
docker pull mysql:5.7
创建容器
-v /www/docker/mysql5.7/log:/var/log/mysql \
-v /www/docker/mysql5.7/data:/var/lib/mysql \
-v /www/docker/mysql5.7/conf:/etc/mysql/conf.d \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:5.7
2.设置容器开机启动
docker update mysql-5.7 --restart=always
3.设置root用户远程访问
docker exec -it mysql-5.7 /bin/bash
登入mysql
mysql -uroot -p
输入密码 root
use mysql
修改密码
update user set authentication_string = password('yourpassword'), password_expired = 'N', password_last_changed = now() where user = 'root';
修改mysql的密码的加密策略
update user set plugin="mysql_native_password";
刷新权限
flush privileges;
退出
quit;