当前位置:网站首页>Docker installing MySQL
Docker installing MySQL
2022-06-21 06:15:00 【Meta39】
《docker Of mysql Mirror warehouse 》
Inquire about docker mysql edition
docker search mysql
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 12738 [OK]
install
docker pull mysql:8.0.23 #8.0.23 yes mysql Version number of
8.0.23: Pulling from library/mysql
f7ec5a41d630: Pull complete
Digest: sha256:6e0014cdd88092545557dee5e9eb7e1a3c84c9a14ad2418d5f2231e930967a38
Status: Downloaded newer image for mysql:8.0.23
docker.io/library/mysql:8.0.23
start-up mysql
First create /docker_data/mysql/conf/my.cnf file
vim /docker_data/mysql/conf/my.cnf
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
character-set-server=utf8mb4
default_authentication_plugin=mysql_native_password
function mysql And mount the volume to the host
docker run -d -p 3306:3306 --privileged=true -v /docker_data/mysql/log:/var/log/mysql -v /docker_data/mysql/data:/var/lib/mysql -v /docker_data/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=123456 --name mysql-8.0.23 mysql:8.0.23
ps see mysql Containers ID,exec Into the container , Sign in mysql, Create users and passwords , to grant authorization , Refresh .
[[email protected] host_data]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3b9f3b3ad3a6 mysql:8.0.23 "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql-8.0.23
fada3bfc9c0d ubuntu "bash" 3 hours ago Up 3 hours u1
0bc3e60b4e1f registry "/entrypoint.sh /etc…" 5 hours ago Up 5 hours 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp registry
[[email protected] host_data]# docker exec -it 3b9f3b3ad3a6 bash
[email protected]:/# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 53
Server version: 8.0.23 MySQL Community Server - GPL
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
# A new user
mysql> CREATE USER 'x'@'%' IDENTIFIED WITH mysql_native_password BY 'x' PASSWORD EXPIRE NEVER;
# Authorize new users
mysql> GRANT all on *.* to 'x'@'%';
# Refresh new user
mysql> FLUSH PRIVILEGES;
# sign out mysql
mysql> exit;
navicat Test connection ( The premise is that the server is open 3306 Port or firewall is turned off )
After mounting the volume , Even if others accidentally put your mysql Deleted , It can also be done through docker run -d -p 3306:3306 --privileged=true -v /docker_data/mysql/log:/var/log/mysql -v /docker_data/mysql/data:/var/lib/mysql -v /docker_data/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=123456 --name mysql-8.0.23 mysql:8.0.23 Reinstall it , And the data won't be lost .
边栏推荐
- Judge whether a tree is a complete binary tree
- Aurora8B10B IP使用 -04- IP例程应用实例
- 复制 代码生成器 生成的代码到idea中,运行后网址报错怎么解决
- C语言课程设计(服装管理系统详解)
- 397 linked list (206. reverse linked list & 24. exchange nodes in the linked list in pairs & 19. delete the penultimate node of the linked list & interview question 02.07. link list intersection & 142
- Do you want to manually implement CSDN dark mode for web page '?
- [data mining] final review Chapter 5
- xshell7远程连接服务器,挂起进程一直维持程序的运行
- 构建和保护小型网络考试
- Dosbox installation
猜你喜欢

sqli-labs25

【利用MSF工具内网复现MS08-067】

FPGA - 7系列 FPGA SelectIO -05- 逻辑资源之OLOGIC

二叉排序树的基本操作

Do you want to manually implement CSDN dark mode for web page '?

You have an error in your SQL syntax; check the manual that corresponds to your MYSQL server
![[mysql] MySQL file structure, page and line records](/img/e3/8b6c39f299679522d84cad64af7a42.png)
[mysql] MySQL file structure, page and line records

Solve the first problem of Huawei's machine test on April 20 by recursion and circulation (100 points)

模块 14 - 15:网络应用通信考试

Asp. Net web API 2 Lesson 18 - working with entity relations in OData
随机推荐
[data mining] final review Chapter 1
xshell7远程连接服务器,挂起进程一直维持程序的运行
Sub-Category Optimization for Multi-View Multi-Pose Object Detection
Cache cache (notes on principles of computer composition)
【JVM】 类加载器(ClassLoader)
Do you want to manually implement CSDN dark mode for web page '?
Which of the children's critical illness insurance companies has the highest cost performance in 2022?
第二章:数据模型(数据库期末复习)
Le premier caractère unique de la chaîne (4)
成立时间用了时间插件,但在网页上修改参数的时候,如果未修改时间第一次保存会报错,第二次才行
sqli-labs23
内卷大厂系列《LRU 缓存淘汰算法》
fastdfs集群
Aurora8B10B IP使用 -02- IP功能设计技巧
深度学习的几种优化方法
Detailed explanation of balanced binary tree is easy to understand
深度理解RNN的梯度消失和LSTM为什么能解决梯度消失
双调查找:数组先递增后递减
FPGA - 7 Series FPGA selectio -06- odelay of logic resources
复制 代码生成器 生成的代码到idea中,运行后网址报错怎么解决