基于docker安装mysql数据库
2021/6/22 20:01:32
本文主要是介绍基于docker安装mysql数据库,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
通过docker-compose快速搭建数据库,并且修改相关字符集为utf8mb4
[root@worker1 ~]# cat /docker/mysql/ conf/ data/ [root@worker1 ~]# cat /docker/mysql/conf/my.conf [mysql] default-character-set = utf8mb4 [client] default-character-set = utf8mb4 [mysqld] pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql symbolic-links=0 character-set-server = utf8mb4 #sql模块修改 sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION #允许最大传输文件大小 max_allowed_packet = 1G [root@worker1 ~]#
[root@worker1 ~]# cat /opt/nfs/docker-yml/mysql.yml version: '2' services: mysql: image: mysql:5.7.22 restart: always container_name: mysql volumes: - /docker/mysql/data:/var/lib/mysql - /docker/mysql/conf:/etc/mysql - /etc/localtime:/etc/localtime environment: - TZ=Asia/Shanghai - MYSQL_ROOT_PASSWORD=ydxny123 ports: - 13306:3306 #network_mode: 'host' [root@worker1 ~]#
这篇关于基于docker安装mysql数据库的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-20部署MySQL集群入门:新手必读指南
- 2024-11-20部署MySQL集群教程:初学者指南
- 2024-11-20部署MySQL集群项目实战:新手教程
- 2024-11-20部署MySQL集群资料:新手入门教程
- 2024-11-20MySQL集群部署教程:入门级详解
- 2024-11-20MySQL集群教程:入门与实践指南
- 2024-11-20部署MySQL集群教程:新手入门指南
- 2024-11-20MySQL读写分离教程:轻松入门
- 2024-11-20部署MySQL集群入门:一步一步搭建你的数据库集群
- 2024-11-19部署MySQL集群学习:入门教程