In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Docker MySql5.7 in the only_full_group_by problem solution, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
The mirror image of MySql. By default, the sql_mode in MySql5.7 contains only_full_group_by,group by statements that sometimes report errors. By manually modifying the sql_mode, deleting the container or creating a new container will invalidate the sql_mode we set manually, so we create an image based on the mysql image to solve the problem that the sql_mode contains only_full_group_by.
Run the container
List-1
Mjduan@mjduan:/opt% docker run-d-p 3306 MYSQL_ALLOW_EMPTY_PASSWORD-- name mysql1 mysql:5.7.95514c31a4e0bc524cee3cdcb962ac73b4fdeb1b5b32d70fa2840e9029b203a8c
Enter the container to install vim
List-2
Mjduan@mjduan:/opt% docker exec-ti mysql1 / bin/bash# executes the following command in the container, root@44504961189a:/opt% apt-get update.root@44504961189a:/opt% apt-get install vim.
In the container, under / etc/mysql/conf.d/, create a new .cnf file and write the configuration to it. We create a new custom.cnf file and write the following:
List-3
Root@44504961189a:/# more / etc/mysql/conf.d/ custom.cnf[mysqld] sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Exit the container and use the docker commit command to create an image from the container
List-4
Mjduan@mjduan:/opt docker commit mysql1 mysql_custom:1.0
After that, docker images can see the mirror mysql_custom:1.0.
Mysql_custom:1.0 is what we need to launch the container, as shown in List-5
List-5
Mjduan@mjduan:/opt% docker run-d-p 3306 MYSQL_ROOT_PASSWORD= new password-- name mysql_mjduan2 mysql_custom:1.044504961189a45442a6b33e5945778b73bc3dd058ab9e794c56b0bbfc3e603bf
After entering the container mysql_mjduan2, you will be prompted for the root password when you enter the mysql command line with the mysql command. If you look at sql_mode again, you will see that sql_mode does not have only_full_group_by.
Be careful not to let anyone else get your image, or you can see your root password through the docker inspect command. However, you can use MYSQL_ROOT_PASSWORD to set the new root password when you create the container.
Note:
It can also be made directly with Dockerfile mysql-based images.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.