In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge of this article "docker how to install mysql", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "docker how to install mysql" article.
1. Use the docker command to download mysqldocker pull mysql:5.7
5.7is the version number. You can check the mysql version you want to install at the https://hub.docker.com/_/mysql?tab=tags website.
2. Use the docker command to create an instance and start it; docker run-p 3306 mydata/mysql/log:/var/log/mysql 3306-- name mysql\-v / mydata/mysql/log:/var/log/mysql\-v / mydata/mysql/data:/var/lib/mysql\-v / mydata/mysql/conf:/etc/mysql\-e MYSQL_ROOT_PASSWORD=root\-d mysql:5.7
Command parsing:
Docker run-p 3306 docker 3306-- name mysql: create a docker container, named mysql, and map port 3306 of Linux to port 3306 of the docker container; (the first 3306 belongs to Linux and the second belongs to docker container)
[- v]: it means directory mount. Linux cannot directly access files in the docker container. You can use this command to map files in the docker container to the Linux directory.
-v / mydata/mysql/log:/var/log/mysql: map the files in the / var/log/mysql directory in the docker container to the / mydata/mysql/log file in Linux
-e MYSQL_ROOT_PASSWORD=root:-e sets the parameters of mysql, here it sets the password of the mysql root user
-d mysql:5.7: start mysql 5.7
All right, mysql has been installed and started.
3. Modify mysql configuration file
Add the following code to the my.cnf file:
[client] default-character-set=utf8 [mysql] default-character-set= UTF8 [mysqld] init_connect='SET collation_connection = utf8_unicode_ci'init_connect='SET NAMES utf8'character-set-server=utf8collation-server=utf8_unicode_ciskip-character-set-client-handshakeskip-name-resolve4, restart mysql Docker restart mysql above is about the content of this article on "how to install mysql in docker". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
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.