How to deploy MySQL service using Docker1. Pull the latest version of MySQL 5.6
2. View the MySQL image
3. Create the directory that needs to be mapped under the home directory: mkdir -p /home/computer/project/mysql/{conf,log,data} 4. Run the container duso docker run -p 53603:3306 --name iot-mysql \ -v /home/computer/project/mysql/conf:/etc/mysql \ -v /home/computer/project/mysql/log:/var/log/mysql \ -v /home/computer/project/mysql/data:/var/lib/mysql \ -e MYSQL_ROOT_PASSWORD=pwd \ -d mysql:5.6 5. Configure MySQL remote connection You need to enter the docker local client to set up a remote access account View running containers
Enter the running container
# Operate mysql in the container -uroot -p123456 mysql> grant all privileges on *.* to root@'%' identified by "password"; select host,user,password from user; # Change password update user set password=password("xxxxx") where user="root"; flush privileges; 6. More Docker Operations Let's look at how to deploy Redis service with Docker1. Pull the latest version of redis image
2. View the Redis image
3. Do not configure the data directory sudo docker run -itd --name redis1 -p 53610:6379 redis --requirepass "psd" 4. Configure data directory sudo docker run -itd --name redis1 -p 53610:6379 -v /home/computer/project/redis/data:/data --restart always redis --appendonly yes --requirepass "psd" 5. Parameter Description -d -> Start the container as a daemon -p 53610:6379 -> Bind to the host port, 53610 host port, 6379 container port --name myredis -> Specify the container name --restart always -> Start at boot --privileged=true -> Increase permissions in the container --requirepass -> Set login password -v /root/docker/redis/data:/data -> Map data directory --appendonly yes -> Enable data persistence 6. More Docker Operations This is the end of this article about how to deploy MySQL and Redis services with Docker. For more information about deploying MySQL and Redis services 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:
|
<<: How to draw a mind map in a mini program
>>: HTML is the central foundation for the development of WEB standards
This article mainly explains how to deploy Elasti...
Table of contents 1. Project Description 1.1 Back...
Data is the core asset of an enterprise and one o...
Table of contents Modify the repository source st...
Preface I believe everyone is familiar with addin...
Connecting to MySQL Here I use navicat to connect...
Sttty is a common command for changing and printi...
Table of contents 1. Introduction 2. Direct recov...
View the nginx configuration file path Through ng...
I read many tutorials, but found that I could nev...
Introduction The module that limits the number of...
Table of contents Preface: Encryption algorithm: ...
The emergence of jQuery has greatly improved our ...
This article shares the specific code of js to im...
As we all know, there are two types of images in c...