MySQL 5.7.44 for Linux安装与配置

前言

为确保生产环境能够稳定高效地运行,公司决定采用备受信赖的MySQL 5.7.44版本数据库作为服务器的强大后台数据支撑。
MySQL 5.7.44凭借其卓越的稳定性、高效的数据处理能力、优化的锁机制以及增强的密码管理政策,不仅确保了数据的安全存储与快速访问,还为服务器提供了坚实可靠的后台保障,完全满足了公司生产环境对于数据库性能与安全性的高要求。

实验环境

Linux发行版:CentOS 8

1.准备工作

  1. 将官方repo源替换为阿里源
#备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

#下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

#建立缓存
yum makecache
  1. 添加Epel 镜像
#备份其他epel源
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup

#下载新repo到/etc/yum.repos.d/
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm

#将 repo 配置中的地址替换为阿里云镜像站地址
sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*

2.下载MySQL安装包并安装MySQL

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

#安装软件包
rpm -ivh mysql57-community-release-el7-8.noarch.rpm

#安装msql不检查GPG密钥
yum -y install mysql-community-server --nogpgcheck

3.初始化数据库

#初始化数据库
mysqld --initialize --user=mysql

#查看日志,初始后的密码在最后一行“root@localhost:”后面
tail -10 /var/log/mysqld.log

#启动mysql并设置开机自启动
systemctl start mysqld
systemctl enable mysqld

#修改mysql root密码
mysql -uroot -p

mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

#查看mysql版本信息
mysqladmin --version

#显示信息为以下内容即成功
mysqladmin  Ver 8.42 Distrib 5.7.44, for Linux on x86_64

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值