云计算运维

Windows Server 2003 - Windows Server 2019 系统工具,Linux系统脚本,Mysql、Nginx、PHP、Redis、K8S、Seafile、Weblogic 、Jenkins、DNS、DHCP、FTP、IIS、Zookeeper、Rabbitmq、Oracle、Tomcat、Mavrn等服务搭建维护,请关注我.

docker安装mysql8.0


拉取mysql8.0镜像

docker pull mysql:8.0

创建文件夹,位置自己随意

mkdir -p /usr/local/mysql/data &&
mkdir -p /usr/local/mysql/logs &&
mkdir -p /usr/local/mysql/conf

创建配置文件my.cnf

touch /usr/local/mysql/conf/my.cnf

配置信息写入

vim /usr/local/mysql/conf/my.cnf

复制一下内容

[mysqld]
user=mysql
character-set-server=utf8
default_authentication_plugin=mysql_native_password
secure_file_priv=/var/lib/mysql
expire_logs_days=7
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
max_connections=1000
default-character-set=utf8
default-character-set=utf8

启动mysql

docker run --restart=always -p 3306:3306 --name mysql -v /usr/local/mysql/conf/my.cnf:/etc/mysql/my.cnf  -v /usr/local/mysql/logs:/var/log/mysql -v /usr/local/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:8.0

docker-mysql默认开启远程连接

  • 分享:
评论
还没有评论
    发表评论 说点什么