Download the mirror
docker pull mysql
Create a mount directory (you can select the directory you want here)
cd /usr/local/docker mkdir mysql cd mysql mkdir {log, data, conf}
Run the container
docker run -p 3306:3306 --name mysql / -v /usr/local/docker/mysql/log:/var/log/mysql / -v /usr/local/docker/mysql/data:/var/lib/mysql / -v /usr/local/docker/mysql/conf:/etc/mysql / -v /etc/localtime:/etc/localtime:ro / -e MYSQL_ROOT_PASSWORD=123456 -d mysql
-e MYSQL_ROOT_PASSWORD=123456 Set root's login password to your password
Check whether the container is started
docker ps
Modify Mysql configuration file
cd /usr/local/docker/mysql/conf vim
I use my configuration file myself, for reference only, you can search for detailed configuration by yourself
[client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 [mysqld] character-set-server=utf8mb4 sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION max_connections=1000 skip-name-resolve
Restart mysql
docker restart mysql
This is the end of this article about the implementation of Docker installation mysql9.1.0. For more related content on Docker installation mysql9.1.0, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!