CentOS7安装MySQL5.7服务
2025年8月 CentOS7.6最小安装版本 切换国内yum源(亲测有效)_centos切换yum源-CSDN博客
先完成上面的操作, 保证自己的源可用
安装mysql rpm包
wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm
sudo rpm -ivh mysql57-community-release-el7-10.noarch.rpm
sudo yum install -y mysql-community-server
如果出现一下报错:
Public key for mysql-community-server-5.7.44-1.el7.x86_64.rpm is not installedFailing package is: mysql-community-server-5.7.44-1.el7.x86_64GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
执行下面的命令
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
sudo yum install -y mysql-community-server
安装开发头文件
sudo yum install -y mysql-community-devel
使用临时密码登录, 修改密码
set global validate_password_policy=0;
set global validate_password_length=1;
ALTER USER 'root'@'localhost' IDENTIFIED BY '你自己的MySQL密码';