Home>Article>Database> How to start mysql in docker container on MAC computer

How to start mysql in docker container on MAC computer

藏色散人
藏色散人 forward
2020-04-26 14:43:30 2484browse

How to start mysql in docker container on MAC computer

docker download image

docker pull mysql docker images

Create container

docker run -d -e MYSQL_ROOT_PASSWORD=root --name mysql57 -v /usr/local/docker_mysql/57/data/mysql:/var/lib/mysql -p 3306:3306 mysql --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --lower_case_table_names=1 docker exec -it mysql57 bash

If an error occurs when connecting to mysql started by Docker:

ERROR 2059 (HY000): Authentication plugin caching_sha2_password’ cannot be loaded

Solution

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root'; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; SELECT plugin FROM mysql.user WHERE User = 'root';

Stop

docker stop mysql

Start

docker start msyql

Recommended: "mysql video tutorial"

The above is the detailed content of How to start mysql in docker container on MAC computer. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete