• 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
    
    
  • 相关阅读:
    一篇文章让你彻底掌握 shell 语言
    Kubernetes Gateway API 攻略:解锁集群流量服务新维度!
    CSS3提高: CSS3 动画
    FLStudio2024汉化破解版在哪可以下载?
    2023最新SSM计算机毕业设计选题大全(附源码+LW)之java教学管理系统upz69
    点击化学TCO-PEG-SH|TCO-PEG-Thiol|反式环辛烯-聚乙二醇-巯基
    23年7/8月前端面试题总结
    SpringBoot--网上商城项目(自定义的参数解析器、购物车后台&前台功能、商品详情页)
    element-ui时间选择器(DatePicker )数据回显
    (原创)视频图像接口之eDP
  • 原文地址:https://blog.csdn.net/modaoshi51991/article/details/139725384