centos7离线安装mysql5.7.25

STEP1:下载安装包

下载地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloads
总站:https://dev.mysql.com/downloads/mysql/在这里插入图片描述


STEP2:卸载系统自带的mariadb-lib

rpm -qa | grep mariadb;
rpm -e mariadb-libs-5.5.52-1.el7.x86_64 --nodeps;

STEP3:安装perl包

  • 材料清单

下载地址:https://pkgs.org/download/


perl-5.16.3-292.el7.x86_64.rpm
perl-Carp-1.26-244.el7.noarch.rpm
perl-constant-1.27-2.el7.noarch.rpm
perl-Encode-2.51-7.el7.x86_64.rpm
perl-Exporter-5.68-3.el7.noarch.rpm
perl-File-Path-2.09-2.el7.noarch.rpm
perl-File-Temp-0.23.01-3.el7.noarch.rpm
perl-Filter-1.49-3.el7.x86_64.rpm
perl-Getopt-Long-2.40-3.el7.noarch.rpm
perl-HTTP-Tiny-0.033-3.el7.noarch.rpm
perl-libs-5.16.3-292.el7.x86_64.rpm
perl-macros-5.16.3-292.el7.x86_64.rpm
perl-parent-0.225-244.el7.noarch.rpm
perl-PathTools-3.40-5.el7.x86_64.rpm
perl-Pod-Escapes-1.04-292.el7.noarch.rpm
perl-podlators-2.5.1-3.el7.noarch.rpm
perl-Pod-Perldoc-3.20-4.el7.noarch.rpm
perl-Pod-Simple-3.28-4.el7.noarch.rpm
perl-Pod-Usage-1.63-3.el7.noarch.rpm
perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm
perl-Socket-2.010-4.el7.x86_64.rpm
perl-Storable-2.45-3.el7.x86_64.rpm
perl-Text-ParseWords-3.29-4.el7.noarch.rpm
perl-threads-1.87-4.el7.x86_64.rpm
perl-threads-shared-1.43-6.el7.x86_64.rpm
perl-Time-HiRes-1.9725-3.el7.x86_64.rpm
perl-Time-Local-1.2300-2.el7.noarch.rpm

  • 安装命令: rpm -ivh *.rpm

STEP4:安装mysql

  • 安装Mysql 5.7.25的rpm包
tar xvf mysql-5.7.25-1.el7.x86_64.rpm-bundle.tar;
rpm -ivh \ 
mysql-community-client-5.7.25-1.el7.x86_64.rpm \
mysql-community-common-5.7.25-1.el7.x86_64.rpm \
mysql-community-libs-5.7.25-1.el7.x86_64.rpm \
mysql-community-server-5.7.25-1.el7.x86_64.rpm;
  • 配置mysql
vim /etc/my.cnf;
>[mysqld]
>port = 3306
>character_set_server = utf8
#启动服务
service mysqld start;
#查询密码
grep 'temporary password' /var/log/mysqld.log;
#修改密码
set password for 'root'@'localhost' = password('YOURPASSWORD');
#本地授权
grant all privileges on *.* to root@"%" identified by 'YOURPASSWORD' with grant option;
#远程授权
grant all privileges on *.* to root@localhost identified by 'YOURPASSWORD' with grant option;
#建库
create database 库名 character set utf8 collate utf8_bin;
#本地授权指定用户
grant all privileges on 库名.* to 用户@localhost identified by 'YOURPASSWORD';
#远程授权指定用户
grant all privileges on 库名.* to 用户@"%" identified by 'YOURPASSWORD' with grant option;
#刷新权限
flush privileges;

在线安装mysql

  • 更新mysql yum源
    rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
  • 修改yum源配置文件/etc/yum.repos.d/mysql-community.repo,将8.0版关闭,开启5.7版
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
  • 安装Mysql
    yum install mysql-community-server mysql-community-client mysql-community-libs
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页