본문 바로가기
Dev/MySQL

[MySQL] yum으로 MySQL 설치 (CentOS 7)

by 흰바다제비 2022. 9. 3.
728x90

yum으로 mysql을 설치하는 법은 간단하다. 

설치하고 서비스에 등록하는 방법은 아래와 같고, 이어서 설치하는 과정과 설치하면서 문제가 생겼던 부분을 설명한다.

 

  • mysql 설치
yum install http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
yum install mysql-community-server

 

  • mysql 서비스 등록
systemctl enable mysqld
systemctl start mysqld

 


설치 과정

1. MySQL을 다운로드 받는다.

yum install http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

처음부터 문제가 발생했다. 해당 주소에 연결이 안되는듯 하다.

 

에러 내용

[root@localhost ~]# yum install http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Loaded plugins: fastestmirror
Cannot open: http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm. Skipping.
Error: Nothing to do

 

직접 사이트 주소로 들어가 파일을 다운받고 경로에 넣어주었다. 다운받은 파일을 직접 설치한다.

yum install mysql57-community-release-el7-11.noarch.rpm

 

mysql 설치 성공

[root@localhost ~]# yum install mysql57-community-release-el7-11.noarch.rpm 
Loaded plugins: fastestmirror
Examining mysql57-community-release-el7-11.noarch.rpm: mysql57-community-release-el7-11.noarch
Marking mysql57-community-release-el7-11.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================================
 Package                                                     Arch                                     Version                                    Repository                                                                  Size
==================================================================================================================================================================================================================================
Installing:
 mysql57-community-release                                   noarch                                   el7-11                                     /mysql57-community-release-el7-11.noarch                                    31 k

Transaction Summary
==================================================================================================================================================================================================================================
Install  1 Package

Total size: 31 k
Installed size: 31 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql57-community-release-el7-11.noarch                                                                                                                                                                        1/1 
  Verifying  : mysql57-community-release-el7-11.noarch                                                                                                                                                                        1/1 

Installed:
  mysql57-community-release.noarch 0:el7-11                                                                                                                                                                                       

Complete!

 

2. MySQL 서버를 설치한다.

yum install mysql-community-server

 

키가 없다는 에러가 떴다. 이전에 이 키를 사용할 건지 입력을 받는 창이 떠서 y라고 했는데 그 이후에 뜬 에러.

 

에러 내용

[root@localhost rpm-gpg]# yum -y install mysql-community-server

warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-libs-compat-5.7.39-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql


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-libs-compat-5.7.39-1.el7.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

 

지금 가지고 있는 키에는 문제가 있는 것 같고, 검색하여 새로 키를 받는 방법을 찾았다.

mysql repo에서 2022년 키를 다운받는다. 

wget https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

 

잘 받아지면 좋겠지만 에러가 떴다.

 

에러 내용

[root@localhost ~]# wget https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
--2022-06-23 10:14:48--  https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
Resolving repo.mysql.com (repo.mysql.com)... 23.45.57.22
Connecting to repo.mysql.com (repo.mysql.com)|23.45.57.22|:443... connected.
ERROR: cannot verify repo.mysql.com's certificate, issued by ‘/C=KR/O=SOOSAN INT/CN=ePrism SSL’:
  Self-signed certificate encountered.
To connect to repo.mysql.com insecurely, use `--no-check-certificate'

 

--no-check-certificate 옵션을 주고 다운받는다.

wget https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 --no-check-certificate

 

RPM-GPG-KEY 다운로드 성공

[root@localhost ~]# wget https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 --no-check-certificate
--2022-06-22 09:19:16--  https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
Resolving repo.mysql.com (repo.mysql.com)... 23.45.57.22
Connecting to repo.mysql.com (repo.mysql.com)|23.45.57.22|:443... connected.
WARNING: cannot verify repo.mysql.com's certificate, issued by ‘/C=KR/O=SOOSAN INT/CN=ePrism SSL’:
  Self-signed certificate encountered.
HTTP request sent, awaiting response... 200 OK
Length: 3175 (3.1K) [text/plain]
Saving to: ‘RPM-GPG-KEY-mysql-2022’

100%[========================================================================================================================================================================================>] 3,175       --.-K/s   in 0s      

2022-06-22 09:19:21 (788 MB/s) - ‘RPM-GPG-KEY-mysql-2022’ saved [3175/3175]

 

이제 다운로드 받은 키를 지정해주어야 한다. 기존에 키가 위치하던 경로에 옮기고 키를 import 한다.

mv RPM-GPG-KEY-mysql-2022 /etc/pki/rpm-gpg/
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022

 

이제 mysql 서버를 설치하면 끝이다.

yum -y install mysql-community-server

 

마지막으로 서비스에 등록

systemctl enable mysqld
systemctl start mysqld

 


참고

 

Centos7 Mysql 5.7 설치

📗 Mysql 5.7 설치 GPG키 다운 및 yum을 이용한 패키지 설치 rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 yum install http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm y..

magnuxx.tistory.com

 

728x90

'Dev > MySQL' 카테고리의 다른 글

[Database] Lock, Block, DeadLock  (0) 2022.09.15
[MySQL] Dynamic SQL을 사용하여 프로시저 생성  (0) 2022.09.04
[MySQL] MySQL MMM  (0) 2022.07.26
[MySQL] Replication 설정  (0) 2022.07.25
[Database] 백업 방식별 특징/장점/단점  (0) 2022.07.16

댓글