Docker 安装 MySQL 8.0.23

1. 准备数据卷
mkdir -p /mydata/mysql/{log,data,conf,mysql-files}
2. 启动MySQL
sudo docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-v /home/mysql/mysql-files:/var/lib/mysql-files \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:8.0.23
3. 创建一个可以远程访问的用户
CREATE USER IF NOT EXISTS 'zhonglianaoti_app'@'%' \
IDENTIFIED WITH mysql_native_password \
BY 'rv4wOFws';
4. 分配所有权限(测试)
GRANT ALL ON *.* TO 'zhonglianaoti_app'@'%';
5. 刷新权限使其生效
FLUSH PRIVILEGES;
上一篇:关于wx.request返回data数据解析抽风的问题


下一篇:Elasticsearch