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
MySQL Workbench - Modeling and design tool 1. Mod...
Adaptive layout is becoming more and more common i...
Table of contents 01 Introduction to GTID 02 How ...
Table of contents Classic approach question Furth...
Introduction Linux is a system that can automatic...
--When connecting to the database, the matching r...
This article uses examples to illustrate the erro...
Table of contents 1. Introduction: 2. Prototype c...
Preface Many years ago, I was a newbie on the ser...
I recently used the input size and maxlength attri...
What is Let’s first look at the concept of Docker...
Table of contents 1. Get the file extension 2. Co...
The container has already been created, how to kn...
1. To optimize the query, try to avoid full table...
Table of contents 1. Direct assignment 2. Shallow...