In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how Docker installs MySQL and MariaDB at the same time. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
The relationship between MySQL and MariaDB
MariaDB database management system is a branch of MySQL, which is mainly maintained by the open source community and licensed by GPL.
The goal of MariaDB is to be fully compatible with MySQL, including API and the command line, making it an easy replacement for MySQL.
After looking at the relationship between MySQL and MariaDB, we must think: since the two have such a close relationship, will there be conflicts when installing and starting at the same time?
The answer is yes, for example: `Port number mainly explained in this article`. Let's first look at the installation of both, and then distinguish the port number of MariaDB from the MySQL during the configuration phase.
Docker install MySQL
Find the image of MySQL on Docker Hub
Docker search mysql
Select an image installation (here we choose centos/mysql-57-centos7)
Docker pull centos/mysql-57-centos7
Start MySQL
Docker run-p 3306 my/mysql/logs:/logs 3306-- name mysql-57- v / my/mysql/conf:/etc/mysql/conf.d-v / my/mysql/logs:/logs-v / my/mysql/data:/var/lib/mysql-e MYSQL_ROOT_PASSWORD=xxx-d centos/mysql-57-centos7
Docker install MariaDB
Find the image of MariaDB on Docker Hub
Docker search mariadb
Select an image installation (here we choose the official image)
Docker pull mariadb
Start MariaDB
Docker run-v / my/mariadb/:/var/lib/mariadb-p 3309 MYSQL_ROOT_PASSWORD=xxx-- privileged=true-- restart unless-stopped-- name mariadbs-d mariadb:latest Note: the port 3309 used by MariaDB startup, the default port 3306 used by MySQL.
Startup completed, docker ps view
MariaDB Port configuration
Although MariaDB starts using port 3309, we cannot access it remotely.
Enter the container directory
Docker exec-it container id bash
Update profile
Vi / etc/mysql/my.cnf
Restart
Docker restart Container id
Remote connection access again, normal!
This is the end of this article on "how to install MySQL and MariaDB in Docker at the same time. I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.