반응형

- Application서버에서 Mariadb가 설치된 DB서버 접근 하기위한 방법

- Mariadb client 설치하여 Mariadb 서버를 접속할 수 있음

- 설치 환경 Linux

 

1. 리눅스 버젼 체크

 

2. mariadb client 다운로드 방법( 두가지)

- mariadb Repository 정보을 등록하여 yum 명령어로 설치

Download MariaDB Server - MariaDB.org

 

Download MariaDB Server - MariaDB.org

REST API Release Schedule Reporting Bugs … Continue reading "Download MariaDB Server"

mariadb.org

- mariadb Repository 정보를 선택후 baseurl 경로에 사이트에 직접 접속하여 해당 내용 직접 다운로드

3. Repository 정보를 등록

[root@TestAPP ~]# cd /etc/yum.repos.d
[root@TestAPP yum.repos.d]# vi MariaDB.repo  <== vi로 신규생성하여 아래 내용 저장

아래 내용====================================================================================
# MariaDB 10.6 RedHatEnterpriseLinux repository list - created 2023-02-20 01:42 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# baseurl = https://rpm.mariadb.org/10.6/rhel/$releasever/$basearch
baseurl = https://tw1.mirror.blendbyte.net/mariadb/yum/10.6/rhel/$releasever/$basearch
module_hotfixes = 1
# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgkey = https://tw1.mirror.blendbyte.net/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1
============================================================================================
~
~
~                                                      
:wq!
[root@TestAPP yum.repos.d]#

 

4. yum 명령어로 mariadb client 설치( mariadb - server까지 필요 없기때문에  client 만 설치)

[root@TestAPP yum.repos.d]# yum install MariaDB-client
MariaDB                                                                                                                                                                                    757 kB/s | 658 kB     00:00    
Last metadata expiration check: 0:00:01 ago on Mon 20 Feb 2023 10:53:07 AM KST.
Dependencies resolved.
===========================================================================================================================================================================================================================
 Package                                              Architecture                              Version                                                                 Repository                                    Size
===========================================================================================================================================================================================================================
Installing:
 MariaDB-client                                       x86_64                                    10.6.12-1.el8                                                           mariadb                                       15 M
Installing dependencies:
 MariaDB-common                                       x86_64                                    10.6.12-1.el8                                                           mariadb                                       88 k
 MariaDB-shared                                       x86_64                                    10.6.12-1.el8                                                           mariadb                                      119 k
     replacing  mariadb-connector-c.x86_64 3.1.11-2.el8_3
     replacing  mariadb-connector-c-config.noarch 3.1.11-2.el8_3
 libpmem                                              x86_64                                    1.6.1-1.el8                                                             appstream                                     78 k
 perl-DBI                                             x86_64                                    1.641-4.module+el8.6.0+891+677074cb                                     appstream                                    739 k
 perl-Math-BigInt                                     noarch                                    1:1.9998.11-7.el8                                                       baseos                                       194 k
 perl-Math-Complex                                    noarch                                    1.59-421.el8                                                            baseos                                       108 k
Enabling module streams:
 perl-DBI                                                                                       1.641                                                                                                                     

Transaction Summary
===========================================================================================================================================================================================================================
Install  7 Packages

Total download size: 16 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): MariaDB-common-10.6.12-1.el8.x86_64.rpm                                                                                                                                             215 kB/s |  88 kB     00:00    
(2/7): libpmem-1.6.1-1.el8.x86_64.rpm                                                                                                                                                      554 kB/s |  78 kB     00:00    
(3/7): MariaDB-shared-10.6.12-1.el8.x86_64.rpm                                                                                                                                             214 kB/s | 119 kB     00:00    
(4/7): perl-Math-BigInt-1.9998.11-7.el8.noarch.rpm                                                                                                                                         6.2 MB/s | 194 kB     00:00    
(5/7): perl-Math-Complex-1.59-421.el8.noarch.rpm                                                                                                                                           9.0 MB/s | 108 kB     00:00    
(6/7): perl-DBI-1.641-4.module+el8.6.0+891+677074cb.x86_64.rpm                                                                                                                              12 MB/s | 739 kB     00:00    
(7/7): MariaDB-client-10.6.12-1.el8.x86_64.rpm                                                                                                                                             3.0 MB/s |  15 MB     00:04    
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                      2.7 MB/s |  16 MB     00:05     
MariaDB                                                                                                                                                                                     44 kB/s |  15 kB     00:00    
Importing GPG key 0x2BB943DC:
 Userid     : "MariaDB Package Signing Key <package-signing-key@mariadb.org>"
 Fingerprint: 1992 69E5 404B D5FC 7D2F E43B CBDB 082B 1CC9 45DB
 From       : https://tw1.mirror.blendbyte.net/mariadb/yum/RPM-GPG-KEY-MariaDB
Is this ok [y/N]: y
Key imported successfully
Importing GPG key 1xC75CC1C8:
 Userid     : "MariaDB Signing Key <signing-key@mariadb.org>"
 Fingerprint: 177F 3010 FE56 CA34 3620 0205 F265 6F24 C74C D1E8
 From       : https://tw1.mirror.blendbyte.net/mariadb/yum/RPM-GPG-KEY-MariaDB
Is this ok [y/N]: y
Key imported successfully
Rocky Linux 8 - AppStream                                                                                                                                                                  421 kB/s | 1.6 kB     00:00    
Importing GPG key 0x6D765N61:
 Userid     : "Release Engineering <infrastructure@rockylinux.org>"
 Fingerprint: 7051 C470 A029 F452 CECE 38B7 17AF 5DAC 6D74 5A60
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                   1/1 
  Running scriptlet: MariaDB-shared-10.6.12-1.el8.x86_64                                                                                                                                                               1/9 
  Installing       : MariaDB-shared-10.6.12-1.el8.x86_64                                                                                                                                                               1/9 
  Running scriptlet: MariaDB-shared-10.6.12-1.el8.x86_64                                                                                                                                                               1/9 
  Running scriptlet: MariaDB-common-10.6.12-1.el8.x86_64                                                                                                                                                               2/9 
  Installing       : MariaDB-common-10.6.12-1.el8.x86_64                                                                                                                                                               2/9 
  Running scriptlet: MariaDB-common-10.6.12-1.el8.x86_64                                                                                                                                                               2/9 
  Installing       : perl-Math-Complex-1.59-421.el8.noarch                                                                                                                                                             3/9 
  Installing       : perl-Math-BigInt-1:1.9998.11-7.el8.noarch                                                                                                                                                         4/9 
  Installing       : perl-DBI-1.641-4.module+el8.6.0+891+677074cb.x86_64                                                                                                                                               5/9 
  Installing       : libpmem-1.6.1-1.el8.x86_64                                                                                                                                                                        6/9 
  Running scriptlet: libpmem-1.6.1-1.el8.x86_64                                                                                                                                                                        6/9 
  Running scriptlet: MariaDB-client-10.6.12-1.el8.x86_64                                                                                                                                                               7/9 
  Installing       : MariaDB-client-10.6.12-1.el8.x86_64                                                                                                                                                               7/9 
  Running scriptlet: MariaDB-client-10.6.12-1.el8.x86_64                                                                                                                                                               7/9 
  Obsoleting       : mariadb-connector-c-3.1.11-2.el8_3.x86_64                                                                                                                                                         8/9 
  Obsoleting       : mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                                                                                                                                  9/9 
  Running scriptlet: mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                                                                                                                                  9/9 
  Verifying        : MariaDB-client-10.6.12-1.el8.x86_64                                                                                                                                                               1/9 
  Verifying        : MariaDB-common-10.6.12-1.el8.x86_64                                                                                                                                                               2/9 
  Verifying        : MariaDB-shared-10.6.12-1.el8.x86_64                                                                                                                                                               3/9 
  Verifying        : mariadb-connector-c-3.1.11-2.el8_3.x86_64                                                                                                                                                         4/9 
  Verifying        : mariadb-connector-c-config-3.1.11-2.el8_3.noarch                                                                                                                                                  5/9 
  Verifying        : libpmem-1.6.1-1.el8.x86_64                                                                                                                                                                        6/9 
  Verifying        : perl-DBI-1.641-4.module+el8.6.0+891+677074cb.x86_64                                                                                                                                               7/9 
  Verifying        : perl-Math-BigInt-1:1.9998.11-7.el8.noarch                                                                                                                                                         8/9 
  Verifying        : perl-Math-Complex-1.59-421.el8.noarch                                                                                                                                                             9/9 

Installed:
  MariaDB-client-10.6.12-1.el8.x86_64           MariaDB-common-10.6.12-1.el8.x86_64       MariaDB-shared-10.6.12-1.el8.x86_64     libpmem-1.6.1-1.el8.x86_64     perl-DBI-1.641-4.module+el8.6.0+891+677074cb.x86_64    
  perl-Math-BigInt-1:1.9998.11-7.el8.noarch     perl-Math-Complex-1.59-421.el8.noarch    

Complete!
[root@TestAPP yum.repos.d]#

 

5. Application서버에서 mariadb 접속 테스트

## 접속 명령어 mysql -h아이피정보 -u접속계정 -p패스워드

[root@TestAPP yum.repos.d]# mysql -h192.168.10.10x -uroot -p'mariadb123'
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4935465
Server version: 10.6.7-MariaDB-log MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| mysql                  |
| information_schema |
+--------------------+
2 rows in set (0.001 sec)

root@localhost:(none)>use mysql;
Database changed

Database changed
MariaDB [mysql]> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| column_stats              |
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| global_priv               |
| gtid_slave_pos            |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| index_stats               |
| innodb_index_stats        |
| innodb_table_stats        |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| roles_mapping             |
| servers                   |
| slow_log                  |
| table_stats               |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| transaction_registry      |
| user                      |
+---------------------------+
31 rows in set (0.000 sec)

+ Recent posts