当前位置: 首页 > news >正文

建设银行网站用户名怎么查创意字体设计网站

建设银行网站用户名怎么查,创意字体设计网站,设计做网站,服装商城网站建设方案文章目录前言一. docker的安装1.1 从阿里下载repo镜像1.2 安装docker1.3 启动docker并查看版本二. 使用docker安装MySQL8.02.1 拉取MySQL镜像2.2 创建容器2.3 操作MySQL容器2.4 远程登录测试总结前言 大家好,又见面了,我是沐风晓月,本文主要…

文章目录

    • 前言
    • 一. docker的安装
      • 1.1 从阿里下载repo镜像
      • 1.2 安装docker
      • 1.3 启动docker并查看版本
    • 二. 使用docker安装MySQL8.0
      • 2.1 拉取MySQL镜像
      • 2.2 创建容器
      • 2.3 操作MySQL容器
      • 2.4 远程登录测试
  • 总结

前言

大家好,又见面了,我是沐风晓月,本文主要讲解如何用docker在centos7系统上安装MySQL8.0,以及如何设置MySQL的远程登录。

文章收录到【容器管理】和【数据库入门到精通专栏】,此专栏是沐风晓月对linux云计算架构实战方向的内容进行的总结,希望能够加深自己的印象,以及帮助到其他的小伙伴😉😉。

如果文章有什么需要改进的地方还请大佬不吝赐教👏👏。

🏠个人主页:我是沐风晓月
🧑个人简介:大家好,我是沐风晓月,双一流院校计算机专业,阿里云社区专家博主😉😉
💕 座右铭: 先努力成长自己,再帮助更多的人 ,一起加油进步🍺🍺🍺
💕欢迎大家:这里是CSDN,我总结知识的地方,喜欢的话请三连,有问题请私信😘

一. docker的安装

1.1 从阿里下载repo镜像

[root@mufenggrow ~]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo

这条命令下载完成后,会把repo包放在/etc/yum.repos.d/下

在这里插入图片描述

使用命令可以查看到我们的repo包,如果没有,说明没有下载成功:

在这里插入图片描述

1.2 安装docker

[root@mufenggrow ~]# yum install docker-ce -y   
## 使用yum安装

安装速度可能稍慢,这时候只需要耐心等待完成即可

1.3 启动docker并查看版本

启动docker

[root@mufenggrow ~]# systemctl  start docker

查看版本

[root@mufenggrow ~]# docker --version
Docker version 20.10.22, build 3a2c30b
[root@mufenggrow ~]# 
[root@mufenggrow ~]# docker version
Client: Docker Engine - CommunityVersion:           20.10.22API version:       1.41Go version:        go1.18.9Git commit:        3a2c30bBuilt:             Thu Dec 15 22:30:24 2022OS/Arch:           linux/amd64Context:           defaultExperimental:      true

二. 使用docker安装MySQL8.0

2.1 拉取MySQL镜像

查看镜像

[root@mufenggrow ~]# docker search mysql --limit 3
NAME      DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
mysql     MySQL is a widely used, open-source relation…   13884     [OK]       
mariadb   MariaDB Server is a high performing open sou…   5294      [OK]       
percona   Percona Server is a fork of the MySQL relati…   600       [OK]

这里有个percona,Percona是一个开源的数据库管理系统,提供了多个解决方案和服务,尤其是针对MySQL、MongoDB和其他数据库管理系统。

开始拉取:

[root@mufenggrow ~]# docker pull mysql
Using default tag: latest
latest: Pulling from library/mysql
72a69066d2fe: Pull complete 
93619dbc5b36: Pull complete 
99da31dd6142: Pull complete 
626033c43d70: Pull complete 
37d5d7efb64e: Pull complete 
ac563158d721: Pull complete 
d2ba16033dad: Pull complete 
688ba7d5c01a: Pull complete 
00e060b6d11d: Pull complete 
1c04857f594f: Pull complete 
4d7cfa90e6ea: Pull complete 
e0431212d27d: Pull complete 
Digest: sha256:e9027fe4d91c0153429607251656806cc784e914937271037f7738bd5b8e7709
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest查看拉取下来的镜像:[root@mufenggrow ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@mufenggrow ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
mysql        latest    3218b38490ce   14 months ago   516MB

2.2 创建容器

[root@mufenggrow ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
mysql        latest    3218b38490ce   14 months ago   516MB
[root@mufenggrow ~]# docker run -id --name=mysql8 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:latest
c3e44b10b7fac5427bb0ac145b4bf70bd7c09174aa48186457250e491aa17821
[root@mufenggrow ~]# 

备注:

-i:保持 STDIN 开放,即使容器未连接。这个选项允许我们在需要的时候与容器的命令行进行交互。

-d:告诉 Docker 在后台运行容器并将容器 ID 打印到控制台。当我们不想直接与容器交互,只想让它在后台运行时,这个选项非常有用。
–name=mysql8:给容器分配一个名称。在这种情况下,容器将被命名为 “mysql8”。

-p 3306:3306:将主机上的端口 3306 映射到容器内部的端口 3306。这是必需的,以允许连接到容器内运行的 MySQL 数据库。

-e MYSQL_ROOT_PASSWORD=root:在容器内设置一个名为 MYSQL_ROOT_PASSWORD 的环境变量,并将其值设置为 root。这将为容器内运行的 MySQL 数据库设置 root 密码。

mysql:latest:指定要为容器使用的 Docker 镜像的名称。在这种情况下,镜像是 mysql,并且我们正在使用 Docker Hub 上可用的最新版本。

这个命令将创建一个名为 “mysql8” 的新 Docker 容器,使用 “mysql” 镜像,将 root 密码设置为 root,并将 MySQL 端口从容器映射到主机。

翻译成英文,此处可以不看,直接跳转到2.3即可:

docker run: This tells Docker to create and start a new container from a specified image.-i: This specifies that we want to keep STDIN open even if the container is not attached, which allows us to interact with the container's command line later if needed.-d: This tells Docker to run the container in the background and print the container ID to the console. This option is useful when we don't want to interact with the container directly and just want it to run in the background.--name=mysql8: This assigns a name to the container. In this case, the container will be named "mysql8".-p 3306:3306: This maps port 3306 on the host to port 3306 inside the container. This is necessary to allow connections to the MySQL database running inside the container.-e MYSQL_ROOT_PASSWORD=root: This sets an environment variable inside the container called MYSQL_ROOT_PASSWORD with a value of root. This sets the root password for the MySQL database running inside the container.mysql:latest: This specifies the name of the Docker image to use for the container. In this case, the image is mysql and we're using the latest version available on Docker Hub.So, altogether, this command creates a new Docker container called mysql8 using the mysql image, sets the root password to root, and maps the MySQL port from the container to the host.

2.3 操作MySQL容器

[root@mufenggrow ~]# docker exec -it mysql8 /bin/bash
root@c3e44b10b7fa:/# mysql -V
mysql  Ver 8.0.27 for Linux on x86_64 (MySQL Community Server - GPL)
root@c3e44b10b7fa:/# 

当容器正在运行时,使用 docker exec 命令可以在容器内部运行额外的命令,其选项和参数如下:

docker exec:告诉 Docker 要在运行的容器内运行额外的命令。

-i:保持 STDIN 开放,允许交互式地输入命令。

-t:分配一个伪终端(pseudo-tty)来启用交互式操作。

mysql8:指定要在其中运行命令的容器的名称或 ID。

/bin/bash:要在容器内运行的命令。在这种情况下,我们要进入容器并打开一个 Bash shell。

因此,这个命令将打开一个交互式的 Bash shell,允许我们在名为 “mysql8” 的运行容器中执行命令。

  • 登录数据库
root@c3e44b10b7fa:/# mysql -uroot -p

在这里插入图片描述

  • 创建远程登录用户
mysql> create user 'admin'@'%' identified with mysql_native_password by '123456';
Query OK, 0 rows affected (0.06 sec)mysql> 

注释:

  • create user:告诉 MySQL 创建一个新用户。

  • ‘admin’@‘%’:指定新用户的用户名和主机名。在这种情况下,用户名为 ‘admin’,‘%’ 表示可以从任何 IP 地址连接。

  • identified with mysql_native_password:指定新用户使用 MySQL 原生密码进行身份验证。

  • by ‘123456’:指定新用户的密码为 ‘123456’。

  • 为远程用户开放权限

mysql> grant all privileges on *.* to admin@'%';
Query OK, 0 rows affected (0.00 sec)flush privileges

2.4 远程登录测试

在这里插入图片描述

总结

以上就是在centos7.6系统上使用docker安装MySQL8.0的全部内容了,感谢观看,欢迎点赞收藏。

我是沐风晓月,文章首发于csdn,你的支持就是我的动力。

💕💕💕 好啦,这就是今天要分享给大家的全部内容了,我们下期再见!✨ ✨ ✨
🍻🍻🍻如果你喜欢的话,就不要吝惜你的一键三连了~

http://www.yayakq.cn/news/640497/

相关文章:

  • 展示型企业网站开发哈尔滨专业网站建设公司
  • 自适应网站制作十堰响应式网站
  • 找个网站这么难2021Wordpress 菜单 增加登陆
  • 墟沟企业建站价格表网络营销课程培训价格
  • 做网站要什么资料竞价网络推广培训
  • 婚恋网站女孩子都是做美容济南网络营销外包服务
  • 莆田网站关键词优化阿里巴巴做国际网站多少钱
  • 网站建设制作服务网站域名在哪里注册
  • 用php做图书管理网站php用户管理系统
  • 网站内外链接怎么做淘宝网页怎么制作
  • 网站内链有什么用软件项目管理的过程
  • 网站和域名区别吗包头公司注册
  • 国内设计师个人网站欣赏天元建设集团有限公司设计研究院征求意见
  • 各种网站推广是怎么做的整站seo包年费用
  • 微信属于营销型网站wordpress主题删不掉
  • 晋中建设局查合同网站排行榜
  • 海南省住房和城乡建设厅官网网站服务器iis做网站
  • 营销型网站建设营销型网站建设广东个人备案网站内容
  • 网站建设的一些原理如何做网站流程图
  • 免费的网站代码做免费看电影的网站不违法吗
  • 合肥做网站推广哪家好wordpress 0day
  • 仿素材下载网站源码装修公司名字
  • 网站打开速度与服务器网站打不开怎么处理
  • 网站建设费如何入账wordpress远程代码执行
  • 青岛营销型网站推广网站域名登记证明
  • 做二手手机的网站有哪些熊猫代理ip
  • 中国河北网站介绍西安网页设计
  • 下做图软件在哪个网站下载两学一做 投稿网站
  • 库易网网站西乡专业网站建设
  • 有那些网站做结伴旅游的杭州的网站建设公司有哪些