In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "docker creates a centos container and downloads MySQL to connect locally". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Pull the mirror image docker pull guyton/centos6 # because it is a docker command, so add docker 2 before the command, check whether the docker images has been pulled successfully # View all the images 3, and several methods for creating docker containers: step by step (recommended for beginners) step by step creation # rely on guyton/centos6 to create a container called mycentos_mysql And there is / bin/bash directory docker create-it-- name mycentos_mysql guyton/centos6 / bin/bash # to check whether the docker ps-a # boot container (you must start the container before entering the container) docker start mycentos_mysql # enter the container docker attach mycentos_mysql method 2: (create and enter the container) docker run-it-- name mycentos_mysql guyton/centos6 method 3: (directly create and set the port and then enter the container) set up The port facilitates the local connection of MySQLdocker run-it-- name mycentos_mysql-p 3307 name mycentos_mysql 3306 guyton/centos6 4. Download MySQL from the container
After entering the container, download MySQL, and chances are that you will encounter a problem, and the solution will be written later:
# download MySQLyum install-y mysql mysql-devel mysql-server# error, unable to download # change the yum source Enter the following code sed-I "s | enabled=1 | enabled=0 | g" / etc/yum/pluginconf.d/fastestmirror.conf mv / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.backup curl-o / etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo yum clean all & & yum makecache # in the container, and then try to download MySQL again, and the download is successful.
Start MySQL, and enter MySQL# to start service mysqld start # and enter mysql-uroot-p
The green ok indicates that the startup is successful. If you enter MySQL for the first time, you don't have a password. Ignore the prompt to enter the password and enter directly.
6. Configure permissions # copy mysql > the following code can be mysql > GRANT ALL ON *. * TO root@'%' IDENTIFIED BY'1' WITH GRANT OPTION; mysql > FLUSH PRIVILEGES
Then you can open locally connected software, such as MySQL or Navicat Premium
Enter the IP of the virtual machine and the port number previously set, and the username and password are the username and password of the virtual machine. Then the connection is successful and you can start to use it.
That's all for "how docker creates a centos container and downloads MySQL to connect locally". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for 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.