Server&DevOps

aws linux에서 MySQL 설치 방법

킨글 2024. 8. 6. 13:31

아래 에러로 인해 MySQL 재설치를 진행했다.

GPG key at https://repo.mysql.com/RPM-GPG-KEY-mysql (0x5072E1F5) is already installed
The GPG keys listed for the "MySQL 5.7 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-5.7.44-1.el7.x86_64
 GPG Keys are configured as: https://repo.mysql.com/RPM-GPG-KEY-mysql
Public key for mysql-community-common-5.7.44-1.el7.x86_64.rpm is not installed. Failing package is: mysql-community-common-5.7.44-1.el7.x86_64
 GPG Keys are configured as: https://repo.mysql.com/RPM-GPG-KEY-mysql
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: https://repo.mysql.com/RPM-GPG-KEY-mysql
Public key for mysql-community-server-5.7.44-1.el7.x86_64.rpm is not installed. Failing package is: mysql-community-server-5.7.44-1.el7.x86_64
 GPG Keys are configured as: https://repo.mysql.com/RPM-GPG-KEY-mysql
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'yum clean packages'.
Error: GPG check FAILED

 

1. MySQL 리포지토리 파일 수정

/etc/yum.repos.d/mysql-community.repo 파일을 열고, gpgcheck=1을 gpgcheck=0으로 변경해 보세요.

이 설정은 GPG 체크를 비활성화합니다.

sudo vi /etc/yum.repos.d/mysql-community.repo

변경 후, 해당 섹션을 다음과 같이 수정합니다:

[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/
enabled=1
gpgcheck=0 # 1에서 0으로 수정
gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql

2. MySQL 설치 시도

GPG 체크를 비활성화한 후, 다시 MySQL 설치를 시도해 보세요.

sudo yum clean all
sudo yum install mysql-community-server -y

 

3. 설치 후 GPG 체크 활성화

설치가 완료된 후, 다시 GPG 체크를 활성화하려면 gpgcheck=1으로 원래 설정으로 되돌리세요.

4. mysql 비밀번호 확인

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