Install MySQL server image under Docker

Source: Internet
Author: User
Tags mysql command line docker ps docker run

Installation environment, CentOS Linux version 3.10.0-514.el7.x86_64

1. Find the latest MySQL image

Docker search MySQL

2, download the latest mysql-server image

Docker pull Mysql/mysql-server:latest 3, after the download is complete, you can view the downloaded image Docker images 4, build container, the-e command to set the default password,--name can customize the name of the image Docker run-- Name Mysql-p 3306:3306-e mysql_root_password=123456-d mysql/mysql-server:latest 5, you can view the generated container Docker Ps-a 6, start the container docker s Tart MySQL 7, running commands in containers Docker exec-it MySQL bash in addition, after starting the service, use the external environment to access CentOS 3306 port hint 1130 error, is because the root account of MySQL only has access to the local account using the Docker exec-it MySQL bash command into the MySQL command line operating environment use Mysqlshow tables;--can see the user's datasheet select host From user where user = ' root ';--you can see that host is localhostupdate user set host = '% ' where user = ' root '; flush privileges;--Update Permission control You can then access MySQL using the external environment's database software.

Install MySQL server image under Docker

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.