Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Docker the process of installing mysql5.7

Shulou Source: shulou.com Published: 2022-06-02 05:42:14 10月03日 Update

This article introduces the relevant knowledge of "the process of installing mysql5.7 in docker". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Find the mysql image on Docker Hub:

[root@docker01 ~] # docker search mysql

The following is the content output

NAME DESCRIPTION STARS OFFICIAL AUTOMATED

Mysql MySQL is a widely used, open-source relation... 6498 [OK]

Mariadb MariaDB is a community-developed fork of MyS... 2049 [OK]

Mysql/mysql-server Optimized MySQL Server Docker images. Create... 475 [OK]

Percona Percona Server is a fork of the MySQL relati... 344 [OK]

Zabbix/zabbix-server-mysql Zabbix Server with MySQL database support 106 [OK]

Hypriot/rpi-mysql RPi-compatible Docker Image with Mysql 88

[root@docker01~] # docker pull mysql:5.7

5.7: Pulling from library/mysql

683abbb4ea60: Downloading [= = >] 21.16MB/22.5MB

0550d17aeefa: Download complete

7e26605ddd77: Download complete

9882737bd15f: Download complete

999c06ab75f6: Download complete

C71d695f9937: Download complete

C38f847c1491: Download complete

74f9c61f40bf: Download complete

30b252a90a12: Downloading [= >] 11.2MB/83.46MB

9f92ebb7da55: Download complete

90303981d276: Download complete

[root@docker01 mysql] # docker run-p3306 PWD/conf:/etc/mysql/conf.d 3306-- name mymysql-v $PWD/conf:/etc/mysql/conf.d-v $PWD/logs:/logs-v $PWD/data:/mysql_data-e MYSQL_ROOT_PASSWORD=123456-d mysql:5.7

D98e86d6b54fae37a1aff3b9f0fb04d5146936b4ce5f2b2c059043035d1b96e9

[root@docker01 mysql] # docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

D98e86d6b54f mysql:5.7 "docker-entrypoint.s..." About aminute ago Up About aminute 0.0.0.0 3306-> 3306/tcp mymysql

Log in to the docker container:

Of the several ways to log in to the docker container, the following is the most common, which ensures that you will not exit the container when you exit.

[root@docker01 mysql] # docker exec-it d98e / bin/bash

Root@d98e86d6b54f:/#

Log in to mysql directly from the host

[root@docker01 mysql] # mysql-uroot-p123456-h 172.17.0.1

Welcome to the MariaDB monitor. Commands end with; or\ g.

Your MySQL connection id is 4

Server version: 5.7.22 MySQLCommunity Server (GPL)

Copyright (c) 2000, 2017, Oracle,MariaDB Corporation Ab and others.

Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

MySQL [(none)] > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | sys |

This is the easiest way to install. Most of the time, we toss about the container as a virtual machine, which is more fun than this installation.

This is the end of the content of "the process of installing mysql5.7 in docker". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Container process content login method method time more knowledge output fun practical successful learning next dilemma actual host host commonly used situation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Linux Apple MySQL Shulou Technology