How to install MySQL and Redis in Docker

How to install MySQL and Redis in Docker

This article is based on the CentOS 7.3 system environment, and is about the installation and use of MySQL and Redis

  • CentOS 7.3
  • Docker-ce

1. Install MySQL image

(1) Pull the MySQL image

docker pull mysql:5.6

(2) Run and configure MySQL

docker run -p 3306:3306 --name xz_mysql
-v /data/mysql/conf:/etc/mysql/conf.g
-v /data/mysql/logs:/logs
-v /data/mysql/data:/var/lib/mysql
-e MYSQL_ROOT_PASSWORD=123456
-d mysql:5.6

(3) Enter the MySQL image container

docker exec -it xz_mysql /bin/bash

(4) Enter MySQL

mysql -uroot -p123456

2. Install the Redis image

(1) Pull the Redis image

docker pull redis:3.2

(2) Run and configure Redis

docker run -p 6379:6379 --name xz_redis
-v /data/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf
-v /data/mysql/data:/data
-d redis:3.2 redis server /usr/local/etc/redis/redis.conf
--appendonly yes

(3) Create a new configuration file redis.conf

cd /usr/local/etc/redis/redis.conf
vim redis.conf

client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60

hz 10

aof-rewrite-incremental-fsync yes

(4) Enter the redis image container

docker exec -it xz_redis redis-cli

This is the end of this article about the steps to install MySQL and Redis with Docker. For more information about installing MySQL and Redis with Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed steps for installing Tomcat, MySQL and Redis with Docker
  • How to install mysql in docker
  • Tutorial on installing MySQL with Docker and implementing remote connection
  • How to install MySQL 8.0 in Docker
  • Docker installation of MySQL (8 and 5.7)
  • How to install MySQL and MariaDB in Docker
  • How to install common components (mysql, redis) in Docker
  • How to install MySQL8 in Docker
  • Docker installation and configuration steps for MySQL

<<:  XHTML Getting Started Tutorial: XHTML Web Page Image Application

>>:  How does the MySQL database implement the XA specification?

Recommend

MySQL8.0.18 configuration of multiple masters and one slave

Table of contents 1. Realistic Background 2. Agre...

Implementing a simple timer in JavaScript

This article example shares the specific code of ...

In-depth analysis of HTML semantics and its related front-end frameworks

About semantics Semantics is the study of the rel...

Detailed tutorial on deploying Hadoop cluster using Docker

Recently, I want to build a hadoop test cluster i...

Nginx configuration to achieve multiple server load balancing

Nginx load balancing server: IP: 192.168.0.4 (Ngi...

JavaScript implements click toggle function

This article example shares the specific code of ...

Solve the mysql user deletion bug

When the author was using MySQL to add a user, he...

Two ways to implement HTML to randomly drag content positions

Test: Chrome v80.0.3987.122 is normal There are t...

React internationalization react-i18next detailed explanation

Introduction react-i18next is a powerful internat...

Solve the problem that ElementUI custom CSS style does not take effect

For example, there is an input box <el-input r...

HTML Tutorial: Definition List

<br />Original text: http://andymao.com/andy...

Detailed explanation of how to use JavaScript paging component

The pagination component is a common component in...