已解决:源 “MySQL 5.7 Community Server“ 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确 和 报错:`ERROR 1045 (28000

这篇具有很好参考价值的文章主要介绍了已解决:源 “MySQL 5.7 Community Server“ 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确 和 报错:`ERROR 1045 (28000。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

问题描述

  1. 服务器上安装mysql时出现了报错,简单记录下解决方案

    "MySQL 5.7 Community Server" 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确。
    
    
     失败的软件包是:mysql-community-client-5.7.40-1.el7.x86_64
     GPG  密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    
  2. 执行:rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

    [root@localhost mysql]# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
    [root@localhost mysql]# yum install mysql-server
    已加载插件:fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    正在解决依赖关系
    --> 正在检查事务
    ---> 软件包 mysql-community-server.x86_64.0.5.7.40-1.el7 将被 安装
    --> 正在处理依赖关系 mysql-community-common(x86-64) = 5.7.40-1.el7,它被软件包 mysql-community-server-5.7.40-1.el7.x86_64 需要
    --> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.7.9,它被软件包 mysql-community-server-5.7.40-1.el7.x86_64 需要
    --> 正在检查事务
    ---> 软件包 mysql-community-client.x86_64.0.5.7.40-1.el7 将被 安装
    --> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.7.9,它被软件包 mysql-community-client-5.7.40-1.el7.x86_64 需要
    ---> 软件包 mysql-community-common.x86_64.0.5.7.40-1.el7 将被 安装
    --> 正在检查事务
    ---> 软件包 mariadb-libs.x86_64.1.5.5.60-1.el7_5 将被 取代
    --> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 2:postfix-2.10.1-7.el7.x86_64 需要
    --> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 2:postfix-2.10.1-7.el7.x86_64 需要
    ---> 软件包 mysql-community-libs.x86_64.0.5.7.40-1.el7 将被 舍弃
    --> 正在检查事务
    ---> 软件包 mysql-community-libs-compat.x86_64.0.5.7.40-1.el7 将被 舍弃
    --> 解决依赖关系完成
    
    依赖关系解决
    
  3. 启动mysql服务并查看运行状态

    [root@localhost mysql]# service mysqld start
    Redirecting to /bin/systemctl start mysqld.service
    [root@localhost mysql]# systemctl status mysqld
    ● mysqld.service - MySQL Server
       Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
       Active: active (running) since 四 2022-10-13 05:42:37 UTC; 7s ago
         Docs: man:mysqld(8)
               http://dev.mysql.com/doc/refman/en/using-systemd.html
      Process: 10239 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
      Process: 10181 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
     Main PID: 10242 (mysqld)
        Tasks: 27
       CGroup: /system.slice/mysqld.service
               └─10242 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
    
    1013 05:42:26 localhost.localdomain systemd[1]: Starting MySQL Server...
    1013 05:42:37 localhost.localdomain systemd[1]: Started MySQL Server.
    
  4. 查看mysql初始密码:grep 'A temporary password' /var/log/mysqld.log

    [root@localhost mysql]# grep 'A temporary password' /var/log/mysqld.log
    2022-10-13T05:42:35.302480Z 1 [Note] A temporary password is generated for root@localhost: !oCdG%3prdP1
    
    1. 使用初始密码进行登录,报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost'
    2. 修改 /etc/my.cnf文件,在最后加入skip-grant-tables
    # For advice on how to change settings please see
    # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
    
    [mysqld]
    #
    # Remove leading # and set to the amount of RAM for the most important data
    # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
    # innodb_buffer_pool_size = 128M
    #
    # Remove leading # to turn on a very important data integrity option: logging
    # changes to the binary log between backups.
    # log_bin
    #
    # Remove leading # to set options mainly useful for reporting servers.
    # The server defaults are faster for transactions and fast SELECTs.
    # Adjust sizes as needed, experiment to find the optimal values.
    # join_buffer_size = 128M
    # sort_buffer_size = 2M
    # read_rnd_buffer_size = 2M
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    skip-grant-tables
    
  5. 然后重启数据库:systemctl restart mysqld

    [root@localhost mysql]# systemctl restart mysqld
    
  6. 可以使用无密码直接登录:

    [root@localhost mysql]# mysql -uroot -p 
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 2
    Server version: 5.7.40 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2022, Oracle and/or its affiliates.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> 
    
  7. 修改root 密码前,先刷新一下权限,然后再修改root密码文章来源地址https://www.toymoban.com/news/detail-535571.html

    mysql> flush privileges;
    Query OK, 0 rows affected (0.01 sec)
    mysql> alter user 'root'@'localhost' identified by '123456';
    Query OK, 0 rows affected (0.00 sec)
    

到了这里,关于已解决:源 “MySQL 5.7 Community Server“ 的 GPG 密钥已安装,但是不适用于此软件包。请检查源的公钥 URL 是否配置正确 和 报错:`ERROR 1045 (28000的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • The GPG keys listed for the “MySQL 8.0 Community Server“ repository are already installed but they a

    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-client-8.0.36-1.el7.x86_64 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mys 照着https://cloud.tenc

    2024年04月25日
    浏览(29)
  • 安装MySQL报错:Failing package is: mysql-community-client-5.7.40-1.el7.x86_64 GPG Keys are configured as

    Failing package is: mysql-community-client-5.7.40-1.el7.x86_64  GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 安装MySQL执行  yum -y install mysql-community-server  时,未安装成功 MySQL GPG 密钥已过期 执行 rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 执行后再执行  yum -y install mysql-community

    2024年02月11日
    浏览(61)
  • MySQL Community Server 8.0.33安装教程【笔记】

    仅安装MySQL Community Server 下载网址:https://dev.mysql.com/downloads/installer/ 1、下载对应版本; 2、下载后,双击安装,弹出界面选择【 Custom 】; 3、弹出界面选择【MySQL Server 8.0.33 - X64】; 3、弹出界面选择**【Execute】→【Next】**; 4、选择【Development Computer】→【Next】; 5、弹出界面默

    2024年02月05日
    浏览(67)
  • CentOS7 安装MySQL 5.7时,报错信息:Failing package is: mysql-community-libs-5.7.44-1.el7.x86_64

    执行命令后,可能会出现下面的错误信息 Public key for mysql-community-libs-5.7.44-1.el7.x86_64.rpm is not installed Failing package is: mysql-community-libs-5.7.44-1.el7.x86_64 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 原因是MySQL的GPG升级了,需要重新导入,执行下面的命令即可:

    2024年03月11日
    浏览(58)
  • MySQL Community Server的安装配置教程(Windows版本)

    MySQL Community Server是开源的MySQL数据库服务的名称。它是MySQL AB在2000年推出的一个开源数据库服务器,现在由Oracle公司维护和管理。 MySQL Community Server是一个关系型数据库系统,支持多种类型的数据和多个并发用户。它提供了强大的SQL查询语言,以及用于数据管理和扩展的扩展

    2024年02月10日
    浏览(31)
  • Failed to start MySQL Community Server in Ubuntu

    一、安装MySQL 本文是通过APT方式安装,安装的最新版本是5.7.21 (注意:通过APT方式安装的版本都是现在最新的版本,通过这种方式安装好之后开机自启动都已经配置好,和命令行上的环境变量,无需手动配置。) 如果提示依赖不足,运行下面命令解决依赖问题,如果没出现依

    2024年02月09日
    浏览(47)
  • ubuntu22.04 密钥存储在过时的 trusted.gpg 密钥环中

    电脑环境:ubuntu22.04 问题: 使用 sudo apt update 命令时,会提示密钥存储在过时的 trusted.gpg 密钥环中,具体提示内容如下: W: https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/dists/jammy/InRelease: 密钥存储在过时的 trusted.gpg 密钥环中(/etc/apt/trusted.gpg),请参见 apt-key(8) 的 DEPRECATION 一节以

    2024年02月08日
    浏览(36)
  • Error: Unable to find a match: mysql-community-server

    问题一[root@lsN4FrHvLd mysql]# yum install mysql-community-server Repository extras is listed more than once in the configuration Last metadata expiration check: 0:15:07 ago on Mon 18 Jul 2022 08:32:24 AM CST. No match for argument: mysql-community-server Error: Unable to find a match: mysql-community-server   今天使用centos8.5安装MySQL出现如上错

    2023年04月09日
    浏览(31)
  • centos安装redis,但是启动redis-server /home/redis/conf/redis7000.conf卡住,怎么解决

    如果你在启动 Redis 服务器时发现过程卡住,这可能是由于几种不同的原因。下面是一些可能导致这种情况的原因以及相应的解决方法: 1. 后台启动 Redis 默认在前台运行。如果你在命令行启动 Redis 并且没有指定它在后台运行,它将在前台运行,看起来好像是“卡住”了。你可

    2024年01月21日
    浏览(36)
  • Linux gpg命令(gpg指令、gpg加密工具)(GNU Privacy Guard、GnuPG)文件压缩加密、文件加密、文件解密、文件压缩密码、解压密码、GPG密钥、数字签名、非对称加密

    GNU Privacy Guard (GnuPG或GPG) 是一个完全免费的开源实现,用于OpenPGP标准的数据加密和解密。这种加密方式可以用于保护敏感数据,确保其在传输过程中不被截获或篡改。本文将介绍在Linux环境中如何使用GPG加密工具。 安装gpg 在大多数Linux发行版中,GPG已经预先安装了。 如果未安

    2024年02月03日
    浏览(42)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包