Docker install database -mariadb
Step 1: Find the Mariadb container address in Dockerhub
Enter: https://registry.hub.docker.com/
Search: Mariadb
to see the version
Step 2: Install Mariadb
The following shows some 具体命令
1. Download the image to docker
docker pull mariadb:latest
2. Create a directory as a mapping directory with the container
mkdir -p /data/mariadb/data
3. Start the Mariadb database
docker run --name mariadb -p 3306:3306 -e MYSQL_ROOT_PASSWORD=输入数据库root用户的密码 -v /data/mariadb/data:/var/lib/mysql -d mariadb
--name start the container set the container name to mariadb
-p sets the port 3306 of the container to map to port 3306 of the host
-e MYSQL_ROOT_PASSWORD Set the environment variable database root user password to enter the password of the database root user
-v sets the container directory /var/lib/mysql to map to the local directory /data/mariadb/data
-d run the container mariadb in the background and return the container id
4. Check if the container is running
docker ps -a
5. Modify the container to self-start
docker container update --restart=always 容器id
Overall command execution:
If there is any infringement, please contact by email, I am sorry.
This is only for learning personal notes, and if there is any reprint, please indicate the source.
Contact email: [email protected]
Learn to test the penguin group together (chat, water group, do not disturb advertising): 826471103