- 查询mysql
docker search mysql - 安装mysql
docker pull mysql - 查看镜像
docker images - 在opt下创建文件夹
cd /opt/
mkdir mysql_docker
cd mysql_docker/
echo $PWD - 启动mysql容器,在var/lib/docker/containers/下查看容器
docker run --name mysqlserver -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d -i -p 3306:3306 mysql:latest - 查看mysql进程
docker ps -a - 进入mysql容器,并登陆mysql
docker exec -it mysqlserver bash
mysql -uroot -p - 开启远程访问权限
use mysql;
select host,user from user;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
flush privileges; -
- 远程客户端连接
-
关闭mysql
docker stop mysqlserver -
开启mysql
docker start mysqlserver
docker环境下安装mysql详细说明
最新推荐文章于 2023-08-06 17:33:55 发布