[BUG日记] 完美解决Centos服务器mysql安装问题:GPG Keys

CentOS 运维避坑实战

CentOS7.9 安装 Python3.8.16 后 yum 报错,快速修复方案

MySQL 数据库需要几个下载和准备步骤。一般情况下,我们需要 root 访问权限和 SSH 服务器访问知识。由于本文涵盖了一些有关 MySQL 安装和设置的基本教程,主要记录了我在CentOS系统中踩下的坑。

常见mysql服务命令

systemctl start mysqld    # 开启mysql服务
systemctl stop mysqld     # 关闭mysql服务
systemctl restart mysqld  # 重启mysql服务
systemctl status mysqld   # 查看mysql服务的状态

Step1 安装Mysql

下载安装Mysql Yum 仓库

wget https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
yum localinstall mysql80-community-release-el7-1.noarch.rpm

安装Mysql 社区

yum install mysql-community-server -y

Step2 遇到公钥对不上的问题

问题如下:

The GPG keys listed for the "ysQL 8.0 Community Server'' repository are already installed [Fix]

解决方式:
(1)To fix this error, import the new GPG key for MySQL.

# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

(2)Once the new key is imported, update the packages.

# yum update

Step3 如何寻找密码

mysql在安装过程中会自动生成一个临时密码,通过如下命令来提取

sudo grep 'password' /var/log/mysqld.log

这里会输出

[Note] A temporary password is generated for root@localhost: Liaka*(Dka&^Kjs

Step4 登录并重置密码

# 启动
systemctl start mysql
mysql -u root -p
# 重置
alter user 'root'@'localhost' identified by '@YourNewPassword';

参考文章

  • https://www.sjkjc.com/mysql/install-on-centos/
  • https://www.51cto.com/article/741252.html
  • https://techglimpse.com/gpg-keys-mysql-not-correct-centos/

CentOS 运维避坑实战

CentOS7.9 安装 Python3.8.16 后 yum 报错,快速修复方案

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值