== Mysql 8
=== docker-compose.yml

=== 安装
[source,bash]
----
# 获取镜像
docker pull mysql/mysql-server:8.0

# 创建并启动容器
docker run \
    --name mysql8 \
    -d \
    -p 3306:3306 \
    -v /Users/wangshaoping/wspsc/software/docker/volume/mysql_v8.0/var/lib/mysql:/var/lib/mysql \
    -e MYSQL_ROOT_PASSWORD=root \
    mysql/mysql-server:8.0 \
    --character-set-server=utf8mb4 \
    --collation-server=utf8mb4_general_ci \
    --lower-case-table-names=1
----

=== 使用
[source,bash]
----
# 进入容器的操作系统命令提示符
docker exec -it mysql8 bash

# 进入 mysql
root@ea3f81a0ec35:/> mysql -uroot -p

# 输入密码: root

# 创建可远程访问的 root 用户
mysql> use mysql;
mysql> create user 'root'@'%' identified with mysql_native_password by 'root';
mysql> grant all privileges on *.* to 'root'@'%' with grant option;
mysql> flush privileges;
----

