Analysis of the configuration process of installing mariadb based on docker

Analysis of the configuration process of installing mariadb based on docker

1. Installation Search the mariadb version to be installed through dockerhub. Execute docker pull to pull the image to the local computer.

Start mariadb

docker run --name mariadb-prod -p 3306:3306 -e MYSQL_ROOT_PASSWORD=QBdata@1017 -v /data/software_docker/mariadb_test/data:/var/lib/mysql -d mariadb:10.5.6

  • --name starts the container and sets the container name to mariadb-prod
  • -p sets the container's port 3306 to map to the host's port 3306
  • -e MYSQL_ROOT_PASSWORD sets the environment variable database root user password to the password of the database root user.
  • -v sets the container directory /var/lib/mysql to map to the local directory /data/software_docker/mariadb_prod/data
  • -d Run the mariadb container in the background and return the container id

Is the installation successful?

Check if the container is running

docker ps -a

Modify the container to start automatically

docker container update --restart=always container id

2. Modify the table name to be case insensitive

Check the container ID through docker ps, and then enter the container with the following command

docker exec -it 5344dfbfc7bc /bin/bash

Enter the /etc/mysql directory and modify the my.cfg file

#Install vimapt-get updateapt-get install vim#Modify my.cfg, add lower_case_table_name=1vim my.cnf

Exit the container and restart the container via docker stop/rm/run

Attachment: Modify the default directory of docker

https://ld246.com/article/1566017283738

For new versions of Docker (greater than v17.05.0), modify the installation (storage) directory: modify (create) /etc/docker/daemon.json and specify the value of the data-root parameter

Proceed as follows:

vim /etc/docker/daemon.json

join in

{
  "data-root": "/store/software/docker",
  "storage-driver": "overlay2" # This is the default setting for Docker, you don't need to add it here}

Then restart the docker service

systemctl restart docker

After completing the migration using any of the above methods and confirming that Docker can work properly, delete the backed-up original directory data:

rm -rf /var/lib/docker.bak

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to install MySQL and MariaDB in Docker
  • Docker implements MariaDB sub-library and sub-table and read-write separation functions
  • How to run mariadb program in docker
  • How to create a MariaDB image in Docker
  • Pycharm remotely connects to the mariadb database in the vagrant virtual machine
  • Detailed discussion of the differences and performance comparison between MySQL and MariaDB
  • Detailed explanation of how to install MariaDB 10.2.4 on CentOS7
  • MariaDB under Linux starts with the root user (recommended)
  • MySQL/MariaDB Root Password Reset Tutorial
  • A brief discussion on the difference between MySQL and MariaDB (performance comparison between mariadb and mysql)

<<:  An article to help you learn more about JavaScript arrays

>>:  How to solve the DOS window garbled problem in MySQL

Recommend

A brief talk about cloning JavaScript

Table of contents 1. Shallow cloning 2. Deep clon...

Detailed explanation of the use of Join in Mysql

In the previous chapters, we have learned how to ...

Implementation example of react project from new creation to deployment

Start a new project This article mainly records t...

15 Vim quick reference tables to help you increase your efficiency by N times

I started using Linux for development and enterta...

How to use vuex in Vue project

Table of contents What is Vuex? Vuex usage cycle ...

Vue implements multi-column layout drag

This article shares the specific code of Vue to i...

CSS3 flip card number sample code

I received a task from the company today, and the...

Web Design Experience: Efficiently Writing Web Code

Originally, this seventh chapter should be a deep ...

How to create a new user in CentOS and enable key login

Table of contents Create a new user Authorize new...

How to view and optimize MySql indexes

MySQL supports hash and btree indexes. InnoDB and...

Teach you step by step to configure MySQL remote access

Preface When using the MySQL database, sometimes ...

VMware + Ubuntu18.04 Graphic Tutorial on Building Hadoop Cluster Environment

Table of contents Preface VMware clone virtual ma...

Vue page monitoring user preview time function implementation code

A recent business involves such a requirement tha...

Markup Language - Phrase Elements

Click here to return to the 123WORDPRESS.COM HTML ...