Install MySQL 8.0 in docker. Refer to the following documents: https://www.runoob.com/docker/docker-install-mysql.html
docker pull mysql:8.0
Create the container and link to the bridge test_ Network, how to create a network bridge, refer to:Docker learning notes — net core project container connecting to MSSQL container (environment: centos7)
docker run -d --name=mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=Aa123456 --network=test_network mysql:8.0
Explanation:
MYSQL_ ROOT_ Password = aa123456 means to set the password of the login account root to aa123456
3306: 3306 indicates external link port
Enter the container and verify that the installation is successful
docker exec -it mysql bash
Execute the following command to view the installation information, and execute the command exit to exit the container!
mysql -u root -p
Using Navicat to link MySQL