EC2에서 RDS 접근 오류

SeungHyeon·2023년 11월 21일
1

DB에 데이터가 제대로 들어있는지 궁금해서 RDB 접근 방법에 대해 찾아보았다

mysql -u 계정이름 -p -h 엔드포인트

그러나 아래 오류가 발생하였다

Command 'mysql' not found, but can be installed with:
sudo apt install mysql-client-core-8.0     # version 8.0.35-0ubuntu0.22.04.1, or
sudo apt install mariadb-client-core-10.6  # version 1:10.6.12-0ubuntu0.22.04.1

그래서 mysql을 다운해주려고 했는데

sudo apt install mysql-client-core-8.0

또 오류가 발생하였다.

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 linux-headers-6.2.0-1015-aws : Depends: linux-aws-6.2-headers-6.2.0-1015 but it is not going to be installed
 linux-image-6.2.0-1015-aws : Depends: linux-modules-6.2.0-1015-aws but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

그래서 sudo apt --fix-broken install 명령어를 통해 이 상황을 해결하려고 했는데

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  linux-aws-6.2-headers-6.2.0-1015 linux-modules-6.2.0-1015-aws
The following NEW packages will be installed:
  linux-aws-6.2-headers-6.2.0-1015 linux-modules-6.2.0-1015-aws
0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded.
5 not fully installed or removed.
Need to get 0 B/37.5 MB of archives.
After this operation, 219 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 74043 files and directories currently installed.)
Preparing to unpack .../linux-modules-6.2.0-1015-aws_6.2.0-1015.15~22.04.1_amd64.deb ...
Unpacking linux-modules-6.2.0-1015-aws (6.2.0-1015.15~22.04.1) ...
Preparing to unpack .../linux-aws-6.2-headers-6.2.0-1015_6.2.0-1015.15~22.04.1_all.deb ...
Unpacking linux-aws-6.2-headers-6.2.0-1015 (6.2.0-1015.15~22.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-aws-6.2-headers-6.2.0-1015_6.2.0-1015.15~22.04.1_all.deb (--unpack):
 cannot copy extracted data for './usr/src/linux-aws-6.2-headers-6.2.0-1015/arch/parisc/include/asm/pdcpat.h' to '/usr/src/linux-aws-6.2-headers-6.2.0-1015/arch/parisc/include/asm/pdcpat.h.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/linux-aws-6.2-headers-6.2.0-1015_6.2.0-1015.15~22.04.1_all.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

오류가 발생해서 확인해보니

ubuntu@ip-172-31-1-161:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.6G  7.6G   45M 100% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           781M  980K  780M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda15     105M  6.1M   99M   6% /boot/efi
tmpfs           391M  4.0K  391M   1% /run/user/1000

저장 공간이 전부 차있는 것을 확인할 수 있었다

그래서 AWS에서 저장공간을 조금 늘려주고

재부팅 해주니까

ubuntu@ip-172-31-1-161:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        16G  7.6G  7.9G  50% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           781M  904K  781M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/xvda15     105M  6.1M   99M   6% /boot/efi
tmpfs           391M  4.0K  391M   1% /run/user/1000

용량이 생겨서

다시 sudo apt --fix-broken install 명령어 쳐주니까

잘 설치되었다.

그래서 다시 sudo apt install mysql-client-core-8.0로 mysql client 설치해주니까

mysql -u 계정이름 -p -h 엔드포인트

위 명령어를 쳤더니

ubuntu@ip-172-31-1-161:~$ mysql -u admin -p -h database-1.cnmgd1eiu1rn.ap-northeast-2.rds.amazonaws.com
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 418
Server version: 8.0.33 Source distribution

Copyright (c) 2000, 2023, 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>

성공적으로 rds에 접속했음을 알 수 있다

profile
어제보다 더 나은 오늘이 되자

0개의 댓글