6 Operation and maintenance-ubuntu16.04.6xenial-basic environment construction-docker integrated mysql

1 installation

1 Create installation directory

mkdir -p /usr/local/docker/mysql

2 Enter the installation directory

cd /usr/local/docker/mysql

3 Edit compose file

version: '3.1'
services:
  db:
    restart: always
    image: mysql:5.7
    container_name: db_mysql
    environment:
      MYSQL_ROOT_PASSWORD: 123456
    ports:
     - 3306:3306
    volumes:  
      - /usr/local/docker/mysql/conf:/etc/mysql 
      - /usr/local/docker/mysql/logs:/var/log/mysql 
      - /usr/local/docker/mysql/data:/var/lib/mysql 

  adminer:
    image: adminer
    restart: always
    ports:
      - 84:8080

4 Start the container

docker-compose up -d

2 verification

2.1 Browser verification

Enter in the browser http://192.168.30.143:84, enter the login name root password 123456, as shown below
Login page
Insert picture description here

2.2 Verification of connection tools

1 Use sqlyog to connect, enter the ip address, user name, and password, and test the connection. The effect diagram is as follows.
Insert picture description here
2 The test connection is successful and the connection is performed. The initial database effect diagram is as follows
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45544465/article/details/100015059