docker 入门笔记 - 安装MySQL

docker  

安装MySQL

  • 获取镜像
 docker pull mysql:5.7
  • 运行MySQL
docker run -d -p 3310:3306 -v /data/docker/mysql/conf:/etc/mysql/conf.d -v /data/docker/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --name mysql01 mysql:5.7  
  • 连接测试
mysql -h10.3.100.59 -P3310 -uroot -p123456  
Welcome to the MariaDB monitor.  Commands end with ; or \g.  
Your MySQL connection id is 4  
Server version: 5.7.36 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]