近期在学习培训prometheus (普罗米修斯)监控录像机.mysql.redis.器皿等实际操作,今日在学习培训prometheus怎样监管mysql主从关系库实际操作,在安裝mysql数据库查询的情况下发觉网络上许多实例教程的mysql在线安装详细地址要不请求超时要不早已不可以应用,由于以前我centos7 的yum库房详细地址早已改为阿里云服务器的镜像站了,所以我尝试从阿里云服务器的镜像站安装下载mysql应该是更快的。

这篇便是按照自身的操作过程写的在阿里巴巴云yum安装下载你的mysql数据库查询

电脑操作系统:centos 7

数据库查询版本号:mysql5.7

第一步:拆换yum源为阿里巴巴云yum

1.备份数据初始的CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2.免费下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/

centos7 假如wget指令不可以应用能够curl指令去免费下载,2个指令选一个实行就可以

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repocurl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

3.升级当地缓存文件

yum clean all

yum makecache

第二步:查询删除系统已安裝的mysql数据库查询避免矛盾

1.查询系统软件中是不是内置安裝mysql

yum list installed | grep mysql

2.删除系统内置的mysql以及依靠(避免矛盾)

yum -y remove 文件夹名称

第三步:免费下载mysql数据库查询版本号安裝

1.假如你的centos沒有wget指令能够先安裝

yum install wget -y

2.到阿里云镜像站选择自己的mysql版本号随后挑选免费下载相匹配的rpm文件mysql最新版下载安装教程-安装mysql详细步骤-第1张图片

MySQL版本号

3.我这边挑选安裝mysql5.7.3.5的版本号,鼠标右键挑选复制地址

mysql最新版下载安装教程-安装mysql详细步骤-第2张图片

4.就下载rpm文件

wget https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-server-5.7.35-1.el7.x86_64.rpm

mysql最新版下载安装教程-安装mysql详细步骤-第3张图片

能够见到马云的网络速度或是迅速的,6MB/S的网络速度

5.安裝mysql

rpm -ivh mysql-community-server-5.7.35-1.el7.x86_64.rpm

安裝提醒有不正确

mysql最新版下载安装教程-安装mysql详细步骤-第4张图片

rpm -ivh mysql-community-server-5.7.35-1.el7.x86_64.rpmwarning: mysql-community-server-5.7.35-1.el7.x86_64.rpm: Header V3 DSA/SHA256 Signature, key ID 5072e1f5: NOKEYerror: Failed dependencies:        mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.35-1.el7.x86_64        mysql-community-common(x86-64) = 5.7.35-1.el7 is needed by mysql-community-server-5.7.35-1.el7.x86_64        net-tools is needed by mysql-community-server-5.7.35-1.el7.x86_64

关键都是提醒缺乏依靠,那咱们就把相对应的依赖包也一并免费下载出来

mysql-community-libs-5.7.35-1.el7.x86_64.rpm

mysql-community-client-5.7.35-1.el7.x86_64.rpm

mysql-community-common-5.7.35-1.el7.x86_64.rpm

net-tools

先安裝net-tools 你能立即应用yum -y install net-tools 立即安裝

逐渐安裝依赖包:

rpm -ivh https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-common-5.7.35-1.el7.x86_64.rpmrpm -ivh https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-5.7.35-1.el7.x86_64.rpmrpm -ivh https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-client-5.7.35-1.el7.x86_64.rpm

在安裝依靠的情况下也许会提醒跟mariadb-libs 的元件库矛盾,大家先删除系统里的mariadb数据库

删掉mariadb

rpm -qa |grep mariadbmariadb-libs-5.5.65-1.el7.x86_64yum remove mariadb-libs-5.5.65-1.el7.x86_64
删掉完后马上安裝上边的好多个依赖包

安装完之后就可以安裝最初那一个

rpm -ivh mysql-community-server-5.7.35-1.el7.x86_64.rpm

mysql最新版下载安装教程-安装mysql详细步骤-第5张图片

安裝进展

进展跳走完大家的mysql早已安装完了

第四步:打开mysql并做配备

运行mysql服务项目并设定开机运行

systemctl start mysqld

查询mysql情况

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repocurl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo0

mysql最新版下载安装教程-安装mysql详细步骤-第6张图片

mysql早已一切正常在运作了

设定启动自动启动

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repocurl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo1

获得mysql的临时性登陆密码

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repocurl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo2

mysql最新版下载安装教程-安装mysql详细步骤-第7张图片

白框里的便是临时性登陆密码

应用临时性登录密码

mysql最新版下载安装教程-安装mysql详细步骤-第8张图片

更改密码

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repocurl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo3

设定字段名为utf-8

查看 mysql 字段名:

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repocurl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo4

mysql最新版下载安装教程-安装mysql详细步骤-第9张图片

编写 my.cnf 文档:vim /etc/my.cnf

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repocurl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo5

[mysqld]

# # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid default-storage-engine=INNODB character-set-server=utf8 collation-server=utf8_general_ci

储存撤出后重新启动mysql

重新启动mysql服务项目:systemctl restart mysqld