“This is the 12th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”

preface

Mysql container deployment: Mysql container deployment: Mysql container deployment: Mysql container deployment

  1. No matter where you install Mysql using Docker you have to do data volume mapping,Don't beDocker database data in the container to run, unless you just test, otherwise delete the container data will be all empty, so be sure to do data persistence! ;
  2. Using Docker to install Mysql IO performance is very low, data read and write in the container once, in the bound volume to read and write once, twice the read and write pressure.

Why do you want to use Docker to install a Mysql? Because it is a test environment of Mysql, it does not pursue performance, but convenience. It is a bit troublesome to install Mysql on a computer by yourself, so you need to customize Settings and set environment variables. Use in their own local use of mysql with docker a command can be installed. Start it when you use it, don’t start it when you don’t use it, don’t take up system performance, data lost can also be copied down online.

The installation

The traditional method is to use the Docker command in Power shell to pull the image:

docker pull mysql 
Copy the code

Mysql > alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run alter table docker run

docker run -d -p 3306:3306 -v /D/DockerFile/MysqlData:/var/lib/mysql --name mysql -e MYSQL_ROOT_PASSWORD=********  mysql
Copy the code

Try to connect using Navicat:

Modifying connection files

Ini file, config-master.ini file, modify the following contents for remote database connection:

[server] # debug Release Production mode AppMode = Release HttpPort = :8080 [database] Db = mysql DbHost = ***.***.*** DbPort = 3306 DbUser = ***** DbPassWord = ********** DbName = my_webCopy the code

Modify the original config.ini file for local database connections:

[server] # debug Release Production mode AppMode = debug HttpPort = :8080 [database] Db = mysql DbHost = 127.0.0.1 DbPort = 3306 DbUser = **********  DbPassWord = ********** DbName = my_webCopy the code

Modify the.gitlab-ci.yml file so that config-master.ini overwrites config.ini when the project is deployed

Stages: - deploy # Task stage sequence, only one deploy deployment stage is written Ini # docker build -t my_gin_web:$CI_JOB_ID. # CI_JOB_ID is an environment variable, runner task ID, can be seen as a database increment ID, -docker stop my_gin_web - docker rm my_gin_web - docker run -d --name my_gin_web -p 8083:8080 My_gin_web :$CI_JOB_ID only: - master # Specifies that this task is performed only on the master branch. Tags: -b4master # Specifies the runner to perform the task. The runner will be prompted to fill in the tag when installing the runner.Copy the code

conclusion

The local database installation is complete, very simple, incidentally modified the CI script. The next step is to connect the Vue CLI to the back-end interface and adjust the data rendering style.