Docker: Installing MySQL

Source: Internet
Author: User
Tags docker run

Article Source: https://www.cnblogs.com/hello-tl/p/9234429.html

1. Add a mirror

Docker pull MySQL

2. Under/data new folder MySQL, go to MySQL folder new folder data

Mkdir/data/mysqlmkdir/data/mysql/data

3. Start

Docker run-d-e mysql_root_password=123456--name MYSQL--net elec_default--restart always  -v/data/mysql/data:/var /lib/mysql-p 3306:3306 MySQL

4. Description

Docker run-d-e mysql_root_password=123456\ # Specify database password MYSQL --net elec_default--restart A lways \ # Specify the container name and set the boot -v/data/mysql/data:/var/lib/mysql-p 3306:3306 mysql # set storage path, port

5. If MySQL is above version 8, it should make a mistake.

Connection to Docker-initiated MySQL appears: Error 2059 (HY000): Authentication plugin ' Caching_sha2_password ' cannot be loaded:õò²»µ½ö¸¶¨µää£¿é ¡£

Solution Solutions

1. Enter the MySQL container

Docker exec-it Mysql/bin/bash

2. Go to MySQL

mysql-uroot-p123456

3. Change the password

ALTER USER ' root ' @ '% ' identified with Mysql_native_password by ' 123456 ';

Article Source: https://www.cnblogs.com/hello-tl/p/9234429.html

Docker: Installing 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.