centos8安装mysql报错

root@hcss-ecs-2c66 ~]# sudo yum update
Repository powertools is listed more than once in the configuration
CentOS Linux 8 - PowerTools 90 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'powertools': Cannot prepare internal mirrorlist: No URLs in mirrorlist


今天想下个mysql,配置下数据库,结果给我来这一出,太搞了。
一个个来

执行以下命令来查看所有存储库配置:

sudo grep -r 'powertools' /etc/yum.repos.d/

/etc/yum.repos.d/
/etc/yum.repos.d/CentOS-Linux-PowerTools.repo:[powertools]
/etc/yum.repos.d/CentOS-Linux-Sources.repo:[powertools-source]
/etc/yum.repos.d/CentOS-PowerTools.repo:[powertools]

然后发现果然powertools 仓库被多次配置了
禁用重复的 powertools 仓库配置:

sudo dnf config-manager --disable powertools

编辑 /etc/yum.repos.d/CentOS-Linux-PowerTools.repo:

sudo nano /etc/yum.repos.d/CentOS-Linux-PowerTools.repo

确保文件内容如下:

[powertools]
name=CentOS Linux $releasever - PowerTools
baseurl=http://mirror.centos.org/$contentdir/$releasever/powertools/$basearch/os/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

编辑 /etc/yum.repos.d/CentOS-PowerTools.repo:

sudo nano /etc/yum.repos.d/CentOS-PowerTools.repo

确保文件内容如下:

[powertools]
name=CentOS Linux $releasever - PowerTools
baseurl=http://mirror.centos.org/$contentdir/$releasever/powertools/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

编辑 /etc/yum.repos.d/CentOS-Linux-Sources.repo:

sudo nano /etc/yum.repos.d/CentOS-Linux-Sources.repo

确保文件内容如下:

[powertools-source]
name=CentOS Linux $releasever - PowerTools Source
baseurl=http://vault.centos.org/$contentdir/$releasever/powertools/Source/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

请注意,我们将只启用一个 powertools 配置块,其余的配置块均被禁用。

清理 DNF 缓存并更新系统:

sudo dnf clean all
sudo dnf update -y

验证 powertools 仓库是否正常:

sudo dnf repolist

添加 MySQL YUM 仓库:

sudo rpm -Uvh https://repo.mysql.com/mysql80-community-release-el8-1.noarch.rpm

安装 MySQL:

sudo yum install mysql-community-server -y

启动 MySQL 服务:

sudo systemctl start mysqld

设置 MySQL 开机自启动:

sudo systemctl enable mysqld

获取临时 root 密码:

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

运行 MySQL 安全安装向导:

sudo mysql_secure_installation

登录 MySQL:

mysql -u root -p

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值