linux,  mysql

Centos7 yum安装MySQL8

配置MySQL的yum源
yum -y install https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
更新yum仓库
yum repolist
安装MySQL
 yum -y install mysql-community-server

报错:

warning: /var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-icu-data-files-8.0.29-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql


The GPG keys listed for the "MySQL 8.0 Community Server" repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.


 Failing package is: mysql-community-icu-data-files-8.0.29-1.el7.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

解决:

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
yum -y install mysql-community-server
或者
yum -y install mysql-community-server  --nogpgcheck 
启动MySQL服务,并设置开机自启
systemctl start mysqld
systemctl enable mysqld
查找初始密码
# 查看初始密码(如无内容直接跳过)
grep 'temporary password' /var/log/mysqld.log
MySQL安全设置

根据提示选择操作

#执行下面命令需要输入初始密码
mysql_secure_installation

留言

您的电子邮箱地址不会被公开。 必填项已用 * 标注