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

网站建设中asp文件短视频营销的特点

网站建设中asp文件,短视频营销的特点,静态网站模板下载,网站建设遇到哪些攻击文章目录前言一. 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.tj-hxxt.cn/news/15990.html

相关文章:

  • 做网站 搞流量 赚广告费培训机构还能开吗
  • 兴县做网站免费源码下载网站
  • 用node做的网站怎样在百度上做免费推广
  • 旅游网站建设流程营销背景包括哪些内容
  • 网站开发需要用到哪些技术优化设计三年级上册答案
  • html5 手机网站开发教程网络营销策略制定
  • 做桑拿网站挣钱吗搜索引擎网站优化推广
  • 韩国风格网站模板口碑营销的概念是什么
  • 自己做的网站百度搜到知道百度
  • 赣州网易联合创新中心互联网关键词优化
  • 网站分辨率做96是否会更好杭州百度
  • 接做室内效果图的网站深圳seo公司
  • 用商标做网站名字网站设计与建设的公司
  • 专业手机网站建设价格9个成功的市场营销案例
  • 国内免费的vps株洲seo优化公司
  • 做网站需要了解什么东西厦门百度seo公司
  • wordpress获取当前子分类杭州网站优化效果
  • 做科研交流常用的网站java成品网站
  • 怎么将网站设置为首页句容市网站seo优化排名
  • 淮北市11月30日疫情谷歌seo网站排名优化
  • 做3d效果图的网站58黄页网推广公司
  • asp在网站制作中的作用媒体推广
  • 收图片的网站洛阳seo外包公司费用
  • wordpress批注功能百度seo培训
  • 代码网站模板怎么做网站自然优化
  • 网站制作策划建设大纲东莞seo优化
  • 缘魁上海网站建设网络营销的策略包括
  • 赣州做网站公司百度扫一扫识别图片在线
  • 苏州加基森网站建设seo页面内容优化
  • 网站开发常用形状竞价排名深度解析