Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install MySQL8.0 in Docker

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how Docker installs MySQL8.0. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Environment: MacOS_Cetalina_10.15.1, Mysql8.0.18, Docker_2.0.0.3

1. Search for mysql in docker warehouse

Docker search mysql

2. Pull mysql8.0 from docker warehouse

Docker pull mysql:8.0 remarks: docker pull mysql / / pull the latest version by default

3. Check whether the local repository image has been downloaded successfully

Docker images mysql:8.0

4. Install and run mysql8.0 container

Docker run-p 3307 MYSQL_ROOT_PASSWORD=root 3306-- name mysql8.0-e MYSQL_ROOT_PASSWORD=root-d mysql:8.0 Note:-p maps the port of the local host to the docker container port (because port 3306 of this machine is already occupied by other versions, so use 3307)-- name container name-e configuration information, configure root password-d image name

5. Check the operation of the mysql8.0 container

Docker ps

6. Log in to mysql with docker

Docker exec-it mysql8.0 bashmysql-uroot-p

7. Remotely log in to mysql using the client connection tool (navicat)

Failed to log in. Error: navicat does not support caching_sha_password encryption.

Reason: mysql8.0 uses a new password encryption method: caching_sha_password

Solution: change to the old encryption method (mysql_native_password) and reset the password

* select host,user,plugin from user

* alter user 'root'@'%' identified with mysql_native_password by' root'

8. Log in to mysql remotely using the client connection tool (navicat)

9. Postscript (commonly used docker command)

Docker search image name / / search image docker pull image name: version number / / pull the corresponding version of the image docker pull image name / / pull the latest image docker images by default / / View the local downloaded image docker ps / / View the running container docker ps-a / / View all containers (including run, stop, Exited status) docker container ls / / View running containers docker rm container ID / / only delete containers that are not running docker rm-f container ID / / you can delete running containers docker run-p local host port number: container service port number-name container name [- e configuration information modification]-d image name docker start container ID / / launch container docker stop container ID / / terminating the container docker rmi image name orID / / deleting the image thank you for reading! This is the end of this article on "how to install MySQL8.0 in Docker". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report