当前位置:网站首页>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;
边栏推荐
- Logstash failed to create queue
- How app inventor accesses resource files in assets directory
- About redis encapsulation tool class using distributed locks
- Microservice project construction III: automatic code generation
- 0. some doubts about learning SolidWorks for the first time
- Penetration problem (main directory, password explosion, database uploading Trojan horse)
- Vscode define code block -- define cursor position
- The method of SolidWorks modifying text font in engineering drawing
- redis. exceptions. ConnectionError: Error 111 connecting to 172.16.8.128:6379. Connection refused.
- JS ask for the day of the year
猜你喜欢

Methods of importing and exporting settings in Altium Designer

1.SolidWorks各模块的学习顺序

Several precise order receiving methods suitable for fresh food wholesale industry

Problems in the deconstruction and assignment of objects, comparison between empty strings and undefined

Browser render passes

0. Quelques doutes au sujet de SolidWorks

redis. exceptions. ConnectionError: Error 111 connecting to 172.16.8.128:6379. Connection refused.

顺时针打印个数组

0. some doubts about learning SolidWorks for the first time

SQL injection question type (manual injection +sqlmap)
随机推荐
Logstash failed to create queue
MySQL queries difference sets (missing data) by linking tables based on an associated field
【Pycharm踩坑记录】配置远程运行后提示,[Errno 2] No such file or directory
4、 Js-es5-i / O
Namespace in TS (1)
Buuctf web (V)
Mobile terminal development I: basic concepts
Buuctf web (III)
Wrap dynamically created child elements in dynamically created structures
Container concept and cloud native
Use of addeventlistener in JS
Learning record 4:einops / / cudnn benchamark=true // hook
DIY UAV (anonymous controller p2+f330 rack)
3、 JS notes
Four ways to install MySQL in Linux
DIY无人机(匿名拓控者P2+F330机架)
Deploy Yum warehouse and NFS shared services
Tiktok keyword search list interface, ultra detailed interface docking steps
2020-12-28
How to efficiently manage commodities and inventory in the beverage wholesale industry