Mac to use Docker to perform the procedure on a brew-installed MySQL _docker

Source: Internet
Author: User
Tags mysql client mysql commands docker ps docker run

Docker is the latest hot technology, the technology industry is a network of red. In the nature of the technical people toss, try to change the local MySQL server to use Docker execution, this article records toss process, to make a memo.

The steps are as follows:

1: Install Docker

Find your own documents.

2: Using the official Docker image of MySQL, the command is as follows

Docker Pull mysql/mysql-server:5.7.16 # # (This is the latest stable version of MySQL when this article is published, and it's best to be consistent with the local version of MySQL, otherwise the third step may be problematic.) )

Because of the GFW, the process is a little long. After the execution of the command, the execution of the word "Docker images" shows that the Mysql-server is successful.

3: Run Docker images, have a few attention points

A: Port number problem, by default 3306 is occupied, so use other ports for mapping, such as 6603

B: Data file mapping problem can be viewed by performing "Ps-ef|grep MySQL". View the section of the--datadir option. As an example of MySQL installed under Mac, the result is

--datadir=/usr/local/var/mysql

After confirming the above question, execute the following command:

Docker run--name my-mysql-server-p 6604:3306-d-v/usr/local/var/mysql:/var/lib/mysql mysql/mysql-server:5.7.16

Then execute "Docker ps-a" to see if the container that is known as My-mysql-server is running. If so, congratulations, you should be successful.

4: The management of MySQL, there are two ways:

A: Enter the MySQL docker environment for execution. Execute the command as follows, and other operations are the same as normal management.

Docker exec-it My-mysql-server Bash

B: External use of MYSQL commands or other MySQL client software links. Need attention, host name part, if use localhost, try 127.0.0.1 general can. If you still have a problem, you will need to reconfigure the permissions table.

The above is a small set to introduce the MAC will brew installed MySQL to use Docker to perform the operation process, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.