当前位置:网站首页>Docker installing MySQL local remote connection docker container MySQL
Docker installing MySQL local remote connection docker container MySQL
2022-06-13 08:41:00 【Python's path to becoming a God】
- install mysql command
sudo docker pull mysql:5.7

- Set up mysql
sudo docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:5.7

Parameters :
- -p 3306:3306: The container of 3306 Port mapping to host's 3306 port
- –name: Name the container
- -v /mydata/mysql/log:/var/log/mysql: Mount the configuration file to the host /mydata/…
- -e MYSQL_ROOT_PASSWORD=root: initialization root The user's password is root
see docker Starting container :
docker ps
- Set up MySQL Default
cd /mydata/mysql/conf
vi my.cnf
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip-name-resolve
# Esc
# :wq
- restart MySQL
docker restart mysql
- Next Empowerment
Into the container
docker exec -it mysql bash
- Connect MySQL
mysql -uroot -p root
- Use mysql
use mysql;
- Empowerment
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
GRANT: Empowering orders
ALL PRIVILEGES: All permissions of the current user
ON: Preposition
.: The corresponding operation permissions of the current user on all databases and tables
TO: Preposition
‘root’@’%’: Authority is given to root user , all ip Can be connected
IDENTIFIED BY ‘root’: Enter password when connecting , The password for root
WITH GRANT OPTION: Allow cascading weighting
- Refresh the permissions
FLUSH PRIVILEGES;
边栏推荐
- Differences among let, VaR and const when JS declares variables
- MySQL parsing serialized fields
- [pychart pit stepping record] prompt after configuring remote operation, [errno 2] no such file or directory
- JS to download files in batches
- Svg text stroke effect
- Vscode double shortcut keys up, down, left and right
- 从零开始-实现JpetStore网站-1-建立项目框架以及项目介绍
- 2、 Three ways to write JS code
- Dest0g3 520 orientation
- PHP PNG to webp
猜你喜欢

SQL injection experiment

顺时针打印个数组
![【Pycharm踩坑记录】配置远程运行后提示,[Errno 2] No such file or directory](/img/71/92c06496a9d982294cac61595e0392.png)
【Pycharm踩坑记录】配置远程运行后提示,[Errno 2] No such file or directory

Remote access and control
![[pychart pit stepping record] prompt after configuring remote operation, [errno 2] no such file or directory](/img/71/92c06496a9d982294cac61595e0392.png)
[pychart pit stepping record] prompt after configuring remote operation, [errno 2] no such file or directory

DNS domain name resolution service

Methods of importing and exporting settings in Altium Designer
![WARNING:tornado.access:404 GET /favicon.ico (172.16.8.1) 1.84ms [附静态文件设置]](/img/6d/6eef1f0ebcab45e9a209a3b6c62b03.png)
WARNING:tornado.access:404 GET /favicon.ico (172.16.8.1) 1.84ms [附静态文件设置]

Use of addeventlistener in JS

Buuctf web (V)
随机推荐
DNS domain name resolution service
Vscode define code block -- define cursor position
HCIP_ MGRE experiment
JS array using the reduce() method
JS - max. of array cases
Penetration problem (main directory, password explosion, database uploading Trojan horse)
關於RSA加密解密原理
Problems in the deconstruction and assignment of objects, comparison between empty strings and undefined
2020-12-28
Yarn package management tool
关于RSA加密解密原理
浅析Visual Studio 使用
2、 Three ways to write JS code
HCIP_ MGRE comprehensive experiment
File upload question type
A solution to create a new EXCEL workbook on win10 computer and change the suffix to xlsm (normally it should be xlsx)
Vscode double shortcut keys up, down, left and right
Dest0g3 520 orientation
MySQL sorts according to the specified order of the specified fields
VI editor