In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Pull Mysql image
Docker pull mysql:5.7
two。 Check the mysql image
Docker inspect mysql:5.7 "Entrypoint": ["docker-entrypoint.sh"]
3. Create a directory for the mysql plug-in locally
# # Mount to container / when docker-entrypoint-initdb.d;MySQL starts, 01_create_database.sql/root/mysql-5.7/init-data 01_create_database.sql # # content create database test_database DEFAULT CHARSET utf8 COLLATE utf8_general_ci; grant all privileges on `test_ database. * to 'test_user'@'%' identified by' 123456mount; flush privileges;## mount to container / var/lib/mysql/root/mysql-5.7/mysql
4. Start mysql
Docker run-p 33336 MYSQL_ROOT_PASSWORD=123456 3306-v / root/mysql-5.7/mysql:/var/lib/mysql-v / root/mysql-5.7/init-data:/docker-entrypoint-initdb.d-e MYSQL_ROOT_PASSWORD=123456-- name mysql_5.7-d mysql/mysql:5.7
5. Enter the container, log in to mysql, and check and find that the library test_database has been created
Docker exec-ti shmysql-uroot-p123456show databases
Summary
The above is the implementation of initialization sql when docker mysql is started, which is 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 to you in time. Thank you very much for your support to the website!
If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!
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.