# docker 中下载 mysql docker pull mysql #启动 docker run --name mysqlname -p 3307:3306 -e MYSQL_ROOT_PASSWORD=Lzslov123! -d imageid (3307是主机端口,3306是容器端口) #进入容器 docker exec -it mysql bash #登录mysql mysql -u root -p ALTER USER 'root'@'localhost' IDENTIFIED BY 'Lzslov123!'; #添加远程登录用户 CREATE USER 'liaozesong'@'%' IDENTIFIED WITH mysql_native_password BY 'Lzslov123!'; GRANT ALL PRIVILEGES ON *.* TO 'liaozesong'@'%';
删除指定容器
docker rm -f <containerid>