In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Due to the need to modify the sql_mode of mysql, each restart of the modification on the command line will fail because the configuration file of mysql under docker is modified.
Operating system: centos7
Docker version: Docker version 17.05.0-ce, build 89658be
Mysql version: 5.7.18
1. Pull the image
Docker pull mysql:5.7.18
two。 List Mirror
[root@zk01 ~] # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEmysql 5.7.18 e799c7f9ae9c 5 weeks ago 407MB
3. Run docker
Docker run-d-p 3306 MYSQL_ROOT_PASSWORD=123456 mysql:5.7.18 3306-- name mymysql-e
4. List the containers that are running
[root@zk01 docker] # docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe1066fe2db35 mysql:5.7.18 "docker-entrypoint..." 6 seconds ago Up 6 seconds 0.0.0.0purl 3306-> 3306/tcp mymysql
5. Enter the container
Docker exec-it e1066fe2db35 / bin/bash
6. View configuration fil
/ etc/mysql/mysql.conf.d/mysqld.cnf
Configuration file content:
[mysqld] pid-file = / var/run/mysqld/mysqld.pidsocket = / var/run/mysqld/mysqld.sockdatadir = / var/lib/mysql#log-error = / var/log/mysql/error.log# By default we only accept connections from localhost#bind-address = 127.0.0.The Disabling symbolic-links is recommended to prevent assorted security risks#symbolic-links=0
7. View the sql_mode of mysql
Mysql > SELECT @ @ GLOBAL.sql_mode +- -+ | @ @ GLOBAL.sql_mode | +-- -+ | ONLY_FULL_GROUP_BY STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER NO_ENGINE_SUBSTITUTION | +- -+ 1 row in set
8. Stop and delete the container
Docker stop e1066fe2db35docker rm e1066fe2db35
9. Restart the container to specify the data directory and configuration file
Docker run-d-p 3306 MYSQL_ROOT_PASSWORD=123456 3306-v / soft/mysql/my.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf-v / soft/mysql/data:/var/lib/mysql-e MYSQL_ROOT_PASSWORD=123456-name mymysql mysql:5.7.18
10. View sql_mode
Mysql > SELECT @ @ GLOBAL.sql_mode;+-+ | @ @ GLOBAL.sql_mode | +-+ | | +-+ 1 row in setmysql > SELECT @ @ SESSION.sql_mode +-+ | @ @ SESSION.sql_mode | +-+ | | +-+ 1 row in set
Summary
The above is the method of modifying the mysql configuration file under docker introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply you in time. Thank you very much for your support to the website!
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.