In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the simple installation of Docker MySQL8 method, the contents of the article are carefully selected and edited by the author, with a certain pertinence, for everyone's reference significance is still relatively great, the following with the author to understand the simple installation of Docker MySQL8 method bar.
Download image docker Hub official website URL: https://hub.docker.com/_/mysql/ download the latest version: docker pull mysql download specified version: docker pull mysql:verison (8.0.11pc8.0) 8) 2. Start the image docker run-d-name mysql-v / data/datadir:/var/lib/mysql-v / etc/mysql/my.cnf:/etc/mysql/my.cnf-p 3306 data/datadir:/var/lib/mysql 3306-e MYSQL_ROOT_PASSWORD=123456 mysql:tag without / data/datadir path or / etc/mysql/my.cnf configuration file, you can use the default Do not need to mount 3, user authorization 1, log in to the started MySQL container docker exec-it mysql / bin/sh2, use the password set by-e MYSQL_ROOT_PASSWORD in the startup command, log in to MySQLmysql-uroot-p3, execute the authorization command, here the root user is an example, create user root@'192.168.0.2' identified by '123456' Grant all privileges on databas_name.* to root@'192.168.0.2';ALTER USER 'root'@'192.168.0.2' IDENTIFIED WITH mysql_native_password BY' 123456 administrator 4, login to MySQLmysql-h 192.168.0.2-u root-p 4, environment variables in the startup command when starting the mysql image, you can adjust the configuration of the MySQL instance by passing one or more environment variables on the docker run command line. Note that if you start the container with a data directory that already contains the database, any of the following variables have no effect: any pre-existing database remains the same when the container starts. Also refer to https://dev.mysql.com/doc/refman/5.7/en/environment-variables.html for documentation of the environment variables that MySQL itself adheres to (especially variables like MYSQL_HOST, which can cause problems when used with this image). MYSQL_ROOT_PASSWORD this variable is mandatory and specifies the password that will be set for the MySQL root superuser account. In the above example, it is set to my-secret-pw. MYSQL_DATABASE this variable is optional and allows you to specify the name of the database to be created when the image starts. If a user / password is provided (see below), the user will be granted superuser access to the database (corresponding to GRANT ALL). The variables MYSQL_USER and MYSQL_PASSWORD are optional and can be used to create a new user and set the user's password. The user will be granted the superuser privilege (see above), which is specified by the MYSQL_DATABASE variable. Both variables are necessary to create a user. Note that you do not need to use this mechanism to create a superuser's root user, which is created by default with the password specified by the MYSQL_ROOT_PASSWORD variable. MYSQL_ALLOW_EMPTY_PASSWORD this is an optional variable. Set to yes to allow the container to start with the empty password of the root user. Note: yes do not set this variable to "not recommended" unless you really know what you are doing, as this will leave your MySQL instance completely unprotected, allowing anyone to gain full root access. MYSQL_RANDOM_ROOT_PASSWORD this is an optional variable. Set yes to generate a random initial password for the root user (using pwgen). The generated root password will be printed to stdout (GENERATED ROOT PASSWORD:.). MYSQL_ONETIME_PASSWORD
Once initialization is complete, the root user (not the user MYSQL_USER specified by the user) is set to expire, forcing the password to change when logging in for the first time. Note: this feature is only supported on MySQL 5.6 +. Using this option on MySQL 5.5 will raise the appropriate error during initialization.
After reading the above about Docker simple installation MySQL8 method, many readers must have some understanding, if you need to get more industry knowledge and information, you can continue to follow our industry information column.
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.