centos下mysql5.7部署

本文提供四种部署方式,请选择属于合适自己的方式

一.centos7 mysql5.7yum方式部署

1.准备工作:

关闭SELinux, 防火墙,修改主机名,解析主机名,时间同步

注意:先将本机的环境清干净
[root@mysql ~]# rpm -qa |grep mariadb
[root@mysql ~]# rpm -e mariadb-libs --nodeps //查询到的所有mariadb的软件都要卸载掉
[root@mysql ~]# rm -rf /var/lib/mysql
[root@mysql ~]# rm -rf /etc/my.cnf

2.下载MySQL源安装包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm

检查mysql源是否安装成功
[root@mysql ~]# yum repolist enabled | grep "mysql.*-community.*"

Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
mysql-connectors-community/x86_64 MySQL Connectors Community                 153
mysql-tools-community/x86_64      MySQL Tools Community                      110
mysql57-community/x86_64          MySQL 5.7 Community Server                 424
3.安装MySQL

[root@mysql ~]#yum -y install mysql-community-server

4.启动服务

首次启动服务时会在软件内部生成软件运行时需要的一些库和表,所以会比较慢
[root@mysql ~]# systemctl restart mysqld && systemctl enable mysqld
获取root用户的临时密码,并修改
[root@mysql ~]# grep "password" /var/log/mysqld.log

2020-05-28T04:02:51.535722Z 1 [Note] A temporary password is generated for root@localhost: 5!a664?L4DWy
5.修改root用户密码方法:

mysql -u root -p
mysql> set password for 'root'@'localhost'='Www.1.com';
mysql> flush privileges;

二.centos7mysql5.7rpm包部署

1.下载mysql-5.7.23-1.el7.x86_64.rpm-bundle-centos7.tar

下载地址:百度云
提取码:mm9h

2.解压
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值