#启动并设置root密码 docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=your_password -d mysql:5.7
#进入容器 docker exec -it mysql bash
#登录mysql mysql -u root -p #设置root用户密码 ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_password';
#添加远程登录用户 CREATE USER 'your_username'@'%' IDENTIFIED WITH mysql_native_password BY 'your_password'; GRANT ALL PRIVILEGES ON *.* TO 'your_password'@'%';