퍼블릭 클라우드

Amazon Linux 2023에서 MySQL 서버와 클라이언트를 설치하는 방법

변군이글루 2024. 4. 18. 20:44
반응형

Amazon Linux 2023에서 MySQL 서버와 클라이언트를 설치하는 방법

테스트 환경

  • 운영체제 정보
$ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2023"
ID="amzn"
ID_LIKE="fedora"
VERSION_ID="2023"
PLATFORM_ID="platform:al2023"
PRETTY_NAME="Amazon Linux 2023.4.20240401"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023"
HOME_URL="https://aws.amazon.com/linux/amazon-linux-2023/"
DOCUMENTATION_URL="https://docs.aws.amazon.com/linux/"
SUPPORT_URL="https://aws.amazon.com/premiumsupport/"
BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023"
VENDOR_NAME="AWS"
VENDOR_URL="https://aws.amazon.com/"
SUPPORT_END="2028-03-15"
$ hostnamectl
 ...
  Virtualization: amazon
Operating System: Amazon Linux 2023.4.20240401
     CPE OS Name: cpe:2.3:o:amazon:amazon_linux:2023
          Kernel: Linux 6.1.82-99.168.amzn2023.x86_64
    Architecture: x86-64
 Hardware Vendor: Amazon EC2
  Hardware Model: t3a.medium
Firmware Version: 1.0

dnf 저장소에서 MySQL 관련 패키지 검색

dnf search mysql
$ dnf search mysql
Last metadata expiration check: 4:58:39 ago on Wed Apr 17 00:28:46 2024.
================================ Name & Summary Matched: mysql ================================
apr-util-mysql.x86_64 : APR utility library MySQL DBD driver
bind-dlz-mysql.x86_64 : BIND server mysql and mysqldyn DLZ modules
collectd-mysql.x86_64 : MySQL plugin for collectd
dovecot-mysql.x86_64 : MySQL back end for dovecot
mysql-selinux.noarch : SELinux policy modules for MySQL and MariaDB packages
perl-DBD-MySQL.x86_64 : A MySQL interface for Perl
perl-DateTime-Format-MySQL.noarch : Parse and format MySQL dates and times
php8.1-mysqlnd.x86_64 : A module for PHP 8.1 applications that use MySQL databases
php8.2-mysqlnd.x86_64 : A module for PHP 8.2 applications that use MySQL databases
postfix-mysql.x86_64 : Postfix MySQL map support
=================================== Summary Matched: mysql ===================================
mariadb105-devel.x86_64 : Files for development of MariaDB/MySQL applications
mariadb105-server-utils.x86_64 : Non-essential server utilities for MariaDB/MySQL applications
perl-DBD-MariaDB.x86_64 : MariaDB and MySQL driver for the Perl5 Database Interface (DBI)

MySQL 서버 설치

패키지 저장소 추가

MySQL Yum Repository

MySQL Yum Repository

MySQL Yum 저장소 추가

sudo wget https://dev.mysql.com/get/mysql80-community-release-el9-5.noarch.rpm
sudo dnf install -y mysql80-community-release-el9-5.noarch.rpm

현재 시스템에서 활성화된 저장소의 목록을 표시

sudo dnf repolist enabled

dnf repolist

728x90

MySQL 8 서버 설치

sudo dnf install -y mysql-community-server
$ sudo dnf install -y mysql-community-server mysql-community-client
...
===========================================================================================
WARNING:
  A newer release of "Amazon Linux" is available.

  Available Versions:

  Version 2023.4.20240416:
    Run the following command to upgrade to 2023.4.20240416:

      dnf upgrade --releasever=2023.4.20240416

    Release notes:
     https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes-2023.4.20240416.html

===========================================================================================

MySQL 버전 확인

mysqld --version
$ mysqld --version
/usr/sbin/mysqld  Ver 8.0.36 for Linux on x86_64 (MySQL Community Server - GPL)

MySQL 서비스 시작 및 활성화

sudo systemctl start mysqld
sudo systemctl enabled mysqld

MySQL 서비스 상태 확인

sudo systemctl status mysqld
$ sudo systemctl status mysqld
● mysqld.service - MySQL Server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
     Active: active (running) since Thu 2024-04-18 03:34:10 UTC; 3s ago
       Docs: man:mysqld(8)
             http://dev.mysql.com/doc/refman/en/using-systemd.html
    Process: 69332 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
   Main PID: 69403 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 4582)
     Memory: 465.0M
        CPU: 7.027s
     CGroup: /system.slice/mysqld.service
             └─69403 /usr/sbin/mysqld

임시 비밀번호 확인

sudo grep 'temporary password' /var/log/mysqld.log
$ sudo grep 'temporary password' /var/log/mysqld.log
2024-04-18T03:34:06.379384Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: CQ50bqKRa>oN
sudo mysql_secure_installation -p

MySQL 클라이언트 설치

sudo dnf install -y mysql-community-client

이제 Amazon Linux 2023 인스턴스에 MySQL 서버와 클라이언트가 설치되었습니다.

 

728x90
반응형