Docker Install Mysql

Source: Internet
Author: User
Tags docker run

Install the MySQL service using the official Docker image

1 Pull MySQL image, use netease acceleration address
Docker pull HUB.C. 163. Com/library/mysql:5.7

2 Renaming a mirror name
Docker tag HUB.C. 163. Com/library/mysql:5.7 mysql:5.7

3 Creating a directory for mounting
sudo mkdir /my/mysql/datadir #用于挂载mysql数据文件 sudomkdir /my/mysql/CONF.D # To mount the MySQL profile sudochown yaoren:docker/my #修改/my directory Owner

4 Creating a container using mirrors
Docker run--name MySQL5. 7 3306:3306 -v/my/mysql/datadir:/var/lib/mysql-v/my/mysql/conf.d:/etc/mysql/conf.d-e MYSQL_ root_password=123456 -D MySQL:5.7

Command parsing:
--name: Container Name

--P: Mapping host host ports

-V: Mount the host directory to the container directory

-E: Setting the environment variable, specifying the root password here

-D: Running containers in the background

5 The test is successful

mysql-h192. 168.18.  -p3306-uroot-p

Docker Install Mysql

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.