How to start mysql in docker container on MAC computer

藏色散人
Release: 2020-04-26 14:43:30
forward
2467 people have browsed it

How to start mysql in docker container on MAC computer

docker download image

docker pull mysql docker images
Copy after login

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
Copy after login

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

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

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';
Copy after login

Stop

docker stop mysql
Copy after login

Start

docker start msyql
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!