当前位置:网站首页>Docker installs MySQL and uses Navicat to connect
Docker installs MySQL and uses Navicat to connect
2022-07-05 06:59:00 【Silence, your name】
Create a mapping directory , I installed it in the user directory
mkdir ~/mysql
mkdir ~/mysql/conf
mkdir ~/mysql/logs
mkdir ~/mysql/data
Execute the above commands respectively , Create file directory
# start-up docker run -id \ -p 3306:3306 \ --name=mysql \ -v $PWD/conf:/etc/mysql/conf.d \ -v $PWD/logs:/logs \ -v $PWD/data:/var/lib/mysql \ -e MYSQL_ROOT_PASSWORD=123456 \ -d mysql \ --character-set-server=utf8mb4 \ --collation-server=utf8mb4_general_ci
# explain
docker run Create a new container , Run this container at the same time -p 3306:3306 Set port mapping Exposed ports : Container port --name The name of the container after startup -v Volume mount Out of container Directory : In-container directory –restart unless-stopped Container restart strategy -e MYSQL_ROOT_PASSWORD=root Set up root User's password , After the container is started, it is used for login mysql \ shell Command line break $PWD Current user directory
Due to the use of $PWD So you need to get into mysql Catalog cd ~/mysql And then execute docker command
Look at the container Whether the startup is successful docker ps
Into the container docker exec -it mysql bash
Sign in msyql mysql -uroot -p123456
Create user
CREATE USER 'silence'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
Authorized user remote login
GRANT ALL PRIVILEGES ON *.* TO 'silence'@'%';
navicat Connect
边栏推荐
- Empire help
- 摄像头的MIPI接口、DVP接口和CSI接口
- The “mode“ argument must be integer. Received an instance of Object
- Executealways of unity is replacing executeineditmode
- Rehabilitation type force deduction brush question notes D3
- Cookie、Session、JWT、token四者间的区别与联系
- NVM Downloading npm version 6.7.0... Error
- Rehabilitation type force deduction brush question notes D2
- Use the Paping tool to detect TCP port connectivity
- 现在有html文件,和用vs制作的mvc(连接了数据库),怎么两个相连?
猜你喜欢
随机推荐
Redis-01. First meet redis
Orin two brushing methods
SOC_SD_DATA_FSM
Vant Weapp SwipeCell設置多個按鈕
2. Addition and management of Oracle data files
ROS2——node节点(七)
Page type
Error: "mountvolume.setup failed for volume PVC fault handling
Rehabilitation type force deduction brush question notes D3
Redis-02. Redis command
【软件测试】05 -- 软件测试的原则
Using handler in a new thread
Vscode editor
Some classic recursion problems
Ros2 topic (VIII)
Adg5412fbruz-rl7 applies dual power analog switch and multiplexer IC
In C language, int a= 'R'
1290_FreeRTOS中prvTaskIsTaskSuspended()接口实现分析
Integer to 8-bit binary explanation (including positive and negative numbers) scope of application -127~+127
What is linting