当前位置:网站首页>docker安装MySQL8.0.28
docker安装MySQL8.0.28
2022-07-27 06:06:00 【good_1uck】
记录在腾讯云服务器docker安装MySQL
此次安装参考另一位博主完成,链接如下
Docker安装Mysql 8.0_Cherry_King的博客-CSDN博客_docker安装mysql8.0
安装docker
具体安装步骤看我另外一篇文章
docker安装和设置_good_1uck的博客-CSDN博客
安装MySQL的docker镜像
docker官网有mysql的镜像及拉去镜像代码

拉取MySQL镜像
docker pull mysql:8.0.28
启动镜像
docker run -itd --name mysql-8 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 mysql:8.0.28
参数说明:
–name mysql-8:所建容器的名称
-p 3306:3306 :映射容器服务的3306端口到宿主机的3306端口,外部主机可以直接通过宿主机ip:3306
访问到 MySQL 的服务。
MYSQL_ROOT_PASSWORD=123456:设置 MySQL 服务 root 用户的密码
mysql:8.0:使用的镜像,即镜像名:tag进入镜像
#查看docker进程
docker ps
#进入docker
docker exec -it mysql-8 /bin/bash配置MySQL远程连接
1、登录MySQL
mysql -uroot -p 1234562、切换数据库并设置远程访问
因为mysql8编码方式不同,所以还需要更改密码的编码方式,不然远程无法连接
use mysql
#查看用户及访问会发现有两个root
select host,user,plugin from user;
#先删除多余的root
delete from user where user ='root' and host='%';
#更改原来的root
update user set host='%' where user ='root';
#修改编码方式
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
#刷新生效
FLUSH PRIVILEGES;设置完成之后就可以连接了。
边栏推荐
- 35. Search Insert Position 搜索插入位置
- A Competitive Swarm Optimizer for Large Scale Optimization
- Drools (5): drools basic syntax (3)
- 12. Integer to Roman整数转罗马数字
- Codeforces Round #809 (Div. 2)(6/6)(Kruskal重构树)
- Analysis of strong tennis cup 2021 PWN competition -- babypwn
- 端口转发小结
- 请教大佬们一个问题,pgsqlcdc任务运行一段时间就不能监测变化了,重启就可以了,这个该从哪方面入
- 内部类--看这篇就懂啦~
- Gbase 8C product introduction
猜你喜欢

(转帖)eureka、consul、nacos的对比2

How to learn C language? This article gives you the complete answer

VIVO应用市场APP上架总结

Watermelon book learning notes - Chapter 4 decision tree

2022 0726 顾宇佳 学习笔记

Reflection on pytorch back propagation

The vscode run command reported an error: the mark "&" is not a valid statement separator in this version.

大疆livox定制的格式CustomMsg格式转换pointcloud2

String类的用法

newest! SASAC releases new measures for digital transformation of state-owned enterprises
随机推荐
Golang encapsulates the packages involved in MySQL and the differences between sqlx and Gorm
Quartus:往别人的工程添加.v文件报错
请教大佬们一个问题,pgsqlcdc任务运行一段时间就不能监测变化了,重启就可以了,这个该从哪方面入
Jmeter:接口自动化测试-BeanShell对数据库数据和返回数据比较
MySQL query operation index optimization practice
Codeforces Round #787 (Div. 3)(7/7)
把Excel转换成CSV/CSV UTF-8
Netease Yunxin appeared at the giac global Internet architecture conference to decrypt the practice of the new generation of audio and video architecture in the meta universe scene
Leetcode series (I): buying and selling stocks
Pytorch notes: td3
【QT】capture.obj:-1: error: LNK2019: 无法解析的外部符号 __imp_htons(解决方法)
美联储SR 11-7:模型风险管理指南(Guidance on Model Risk Management)-万字收藏
Drools (5): drools basic syntax (3)
Interpretation of deepsort source code (II)
Interpretation of deepsort source code (VII)
MySQL optimization SQL related (continuous supplement)
线性表 -- 栈和队列
Internal class -- just read this article~
Drools(5):Drools基础语法(3)
C#时间相关操作