当前位置:网站首页>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;
边栏推荐
- 淘宝商品销量接口/淘宝商品销量监控接口/商品累计销量接口
- MySQL parsing serialized fields
- Maternal and infant supplies wholesale industry uses management software to improve efficiency and realize cost reduction and efficiency increase
- LVM management exercise
- Undefined and null in JS
- Namespace in TS (2)
- Process and scheduled task management
- HCIP_ MGRE experiment
- MySQL sorts according to the specified order of the specified fields
- Document contains question type
猜你喜欢
Form exercise 2
HCIP_ MGRE comprehensive experiment
Buuctf web (III)
DNS domain name resolution service
A solution to create a new EXCEL workbook on win10 computer and change the suffix to xlsm (normally it should be xlsx)
About redis encapsulation tool class using distributed locks
JS - simple ATM of the for cycle case
d3.js&nvd3. JS - how to set the y-axis range - d3 js & nvd3. js — How to set y-axis range
How to efficiently manage commodities and inventory in the beverage wholesale industry
HCIP_ MGRE experiment
随机推荐
The method of SolidWorks modifying text font in engineering drawing
1.SolidWorks各模块的学习顺序
Explanation of JS event loop mechanism and asynchronous tasks
学习记录4: einops // cudnn.benchamark=true // hook
Logstash failed to create queue
anaconda下安装pytorch
Penetration problem (main directory, password explosion, database uploading Trojan horse)
Logstash configuration reference article
Shellshock Attack Lab
JS - print 99 multiplication table of the for cycle case
System safety and Application
How can the small and medium-sized lighting industry make use of the digital transformation to stand out from the encirclement?
Is there any good management software to solve the problems faced by tea wholesalers
JS - array de duplication in the array object case
Custom exception class myexception
redis.exceptions.ConnectionError: Error 111 connecting to 172.16.8.128:6379. Connection refused.
Buuctf web (III)
淘宝商品销量接口/淘宝商品销量监控接口/商品累计销量接口
抖音关键词搜索列表接口,超详细的接口对接步骤
Yarn package management tool