安装brew
/usr/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
执行
source ~/.zprofile
查看安装成功
brew --version
安装docker
brew install --cask --appdir=/Applications docker
安装成功后查看docker版本
docker --version
安装mysql
docker pull mysql:8.0.29
4cf4d75e858ca6f4382928b7cc8ffa429f09f49011b2e027b6367794edd63469
拷贝一份配置文件,先随便启动一个镜像
docker run -p 3306:3306 --name mysql8 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8.0.29
进入容器
docker exec -it mysql8 bash
登录mysql
mysql -u root -p
进行授权远程连接
GRANT ALL ON *.* TO 'root'@'%';//远程连接
flush privileges; //刷新权限
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;//更改加密规则
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';//设置密码
flush privileges;//刷新权限
GRANT ALL PRIVILEGES ON *.* TO 'tester'@'%'