카테고리 없음

Rocky Linux 9 (9.5) MariaDB installation and configuration

강서버 2025. 4. 2. 12:18
반응형

Install MariaDB (mariadb-server, mariadb)

$ sudo dnf install mariadb-server mariadb

 

[ Execution log ]

[gangserver@localhost ~]$ sudo dnf install mariadb-server mariadb

[sudo] gangserver의 암호: 
마지막 메타자료 만료확인(0:16:33 이전): 2025년 04월 02일 (수) 오전 11시 34분 31초.
종속성이 해결되었습니다.
================================================================================
 꾸러미                       구조     버전                   저장소       크기
================================================================================
설치 중:
 mariadb                      x86_64   3:10.5.27-1.el9_5      appstream   1.6 M
 mariadb-server               x86_64   3:10.5.27-1.el9_5      appstream   9.7 M
종속 꾸러미 설치 중:
 mariadb-common               x86_64   3:10.5.27-1.el9_5      appstream    27 k
 mariadb-connector-c          x86_64   3.2.6-1.el9_0          appstream   195 k
 mariadb-connector-c-config   noarch   3.2.6-1.el9_0          appstream   9.8 k
 mariadb-errmsg               x86_64   3:10.5.27-1.el9_5      appstream   211 k
 mysql-selinux                noarch   1.0.13-1.el9_5         appstream    36 k
 perl-DBD-MariaDB             x86_64   1.21-16.el9_0          appstream   151 k
 perl-File-Copy               noarch   2.34-481.el9           appstream    19 k
 perl-Sys-Hostname            x86_64   1.23-481.el9           appstream    16 k
취약한 종속 꾸러미 설치 중:
 mariadb-backup               x86_64   3:10.5.27-1.el9_5      appstream   6.5 M
 mariadb-gssapi-server        x86_64   3:10.5.27-1.el9_5      appstream    14 k
 mariadb-server-utils         x86_64   3:10.5.27-1.el9_5      appstream   211 k

연결 요약
================================================================================
설치  13 꾸러미

전체 내려받기 크기: 19 M
설치된 크기 : 110 M
진행할까요? [y/N]: y
꾸러미 내려받기 중:
(1/13): mariadb-connector-c-config-3.2.6-1.el9_  45 kB/s | 9.8 kB     00:00    
(2/13): mariadb-connector-c-3.2.6-1.el9_0.x86_6 735 kB/s | 195 kB     00:00    
(3/13): mysql-selinux-1.0.13-1.el9_5.noarch.rpm 134 kB/s |  36 kB     00:00    
(4/13): perl-Sys-Hostname-1.23-481.el9.x86_64.r 275 kB/s |  16 kB     00:00    
(5/13): perl-File-Copy-2.34-481.el9.noarch.rpm  571 kB/s |  19 kB     00:00    
(6/13): mariadb-server-utils-10.5.27-1.el9_5.x8 2.7 MB/s | 211 kB     00:00    
(7/13): mariadb-gssapi-server-10.5.27-1.el9_5.x 256 kB/s |  14 kB     00:00    
(8/13): mariadb-common-10.5.27-1.el9_5.x86_64.r 569 kB/s |  27 kB     00:00    
(9/13): mariadb-errmsg-10.5.27-1.el9_5.x86_64.r 1.8 MB/s | 211 kB     00:00    
(10/13): mariadb-10.5.27-1.el9_5.x86_64.rpm     2.7 MB/s | 1.6 MB     00:00    
(11/13): perl-DBD-MariaDB-1.21-16.el9_0.x86_64. 1.4 MB/s | 151 kB     00:00    
(12/13): mariadb-backup-10.5.27-1.el9_5.x86_64. 3.7 MB/s | 6.5 MB     00:01    
(13/13): mariadb-server-10.5.27-1.el9_5.x86_64. 3.6 MB/s | 9.7 MB     00:02    
--------------------------------------------------------------------------------
합계                                            5.4 MB/s |  19 MB     00:03     
연결 확인 실행 중
연결 확인에 성공했습니다.
연결 시험 실행 중
연결 시험에 성공했습니다.
연결 실행 중
  준비 중     :                                                             1/1 
  설치 중     : mariadb-connector-c-config-3.2.6-1.el9_0.noarch            1/13 
  설치 중     : mariadb-common-3:10.5.27-1.el9_5.x86_64                    2/13 
  설치 중     : mariadb-connector-c-3.2.6-1.el9_0.x86_64                   3/13 
  설치 중     : perl-Sys-Hostname-1.23-481.el9.x86_64                      4/13 
  설치 중     : perl-DBD-MariaDB-1.21-16.el9_0.x86_64                      5/13 
  설치 중     : mariadb-errmsg-3:10.5.27-1.el9_5.x86_64                    6/13 
  설치 중     : perl-File-Copy-2.34-481.el9.noarch                         7/13 
  구현 중     : mysql-selinux-1.0.13-1.el9_5.noarch                        8/13 
  설치 중     : mysql-selinux-1.0.13-1.el9_5.noarch                        8/13 
  구현 중     : mysql-selinux-1.0.13-1.el9_5.noarch                        8/13 
libsemanage.semanage_direct_install_info: Overriding mysql module at lower priority 100 with module at priority 200.

  설치 중     : mariadb-server-utils-3:10.5.27-1.el9_5.x86_64              9/13 
  설치 중     : mariadb-gssapi-server-3:10.5.27-1.el9_5.x86_64            10/13 
  설치 중     : mariadb-backup-3:10.5.27-1.el9_5.x86_64                   11/13 
  설치 중     : mariadb-3:10.5.27-1.el9_5.x86_64                          12/13 
  구현 중     : mariadb-server-3:10.5.27-1.el9_5.x86_64                   13/13 
  설치 중     : mariadb-server-3:10.5.27-1.el9_5.x86_64                   13/13 
  구현 중     : mariadb-server-3:10.5.27-1.el9_5.x86_64                   13/13 
  구현 중     : mysql-selinux-1.0.13-1.el9_5.noarch                       13/13 
  구현 중     : mariadb-server-3:10.5.27-1.el9_5.x86_64                   13/13 
  확인 중     : mysql-selinux-1.0.13-1.el9_5.noarch                        1/13 
  확인 중     : mariadb-connector-c-3.2.6-1.el9_0.x86_64                   2/13 
  확인 중     : mariadb-connector-c-config-3.2.6-1.el9_0.noarch            3/13 
  확인 중     : perl-Sys-Hostname-1.23-481.el9.x86_64                      4/13 
  확인 중     : perl-File-Copy-2.34-481.el9.noarch                         5/13 
  확인 중     : mariadb-server-utils-3:10.5.27-1.el9_5.x86_64              6/13 
  확인 중     : mariadb-server-3:10.5.27-1.el9_5.x86_64                    7/13 
  확인 중     : mariadb-gssapi-server-3:10.5.27-1.el9_5.x86_64             8/13 
  확인 중     : mariadb-errmsg-3:10.5.27-1.el9_5.x86_64                    9/13 
  확인 중     : mariadb-common-3:10.5.27-1.el9_5.x86_64                   10/13 
  확인 중     : mariadb-backup-3:10.5.27-1.el9_5.x86_64                   11/13 
  확인 중     : mariadb-3:10.5.27-1.el9_5.x86_64                          12/13 
  확인 중     : perl-DBD-MariaDB-1.21-16.el9_0.x86_64                     13/13 

설치되었습니다:
  mariadb-3:10.5.27-1.el9_5.x86_64                                              
  mariadb-backup-3:10.5.27-1.el9_5.x86_64                                       
  mariadb-common-3:10.5.27-1.el9_5.x86_64                                       
  mariadb-connector-c-3.2.6-1.el9_0.x86_64                                      
  mariadb-connector-c-config-3.2.6-1.el9_0.noarch                               
  mariadb-errmsg-3:10.5.27-1.el9_5.x86_64                                       
  mariadb-gssapi-server-3:10.5.27-1.el9_5.x86_64                                
  mariadb-server-3:10.5.27-1.el9_5.x86_64                                       
  mariadb-server-utils-3:10.5.27-1.el9_5.x86_64                                 
  mysql-selinux-1.0.13-1.el9_5.noarch                                           
  perl-DBD-MariaDB-1.21-16.el9_0.x86_64                                         
  perl-File-Copy-2.34-481.el9.noarch                                            
  perl-Sys-Hostname-1.23-481.el9.x86_64                                         

완료되었습니다!

 

Check the installation version

$ mariadb --version

 

[ Execution log ]

[gangserver@localhost ~]$ mariadb --version
mariadb  Ver 15.1 Distrib 10.5.27-MariaDB, for Linux (x86_64) using  EditLine wrapper

 

 

Start MariaDB service at boot time and run MariaDB service immediately

$ sudo systemctl enable --now mariadb

or

$ sudo systemctl enable mariadb           <- Start MariaDB service at boot time

$ sudo systemctl start mariadb               <- Running MariaDB service

 

[ Execution log ]

[gangserver@localhost ~]$ sudo systemctl enable --now mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

 

[gangserver@localhost ~]$ sudo systemctl enable mariadb
[sudo] gangserver의 암호: 
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

 

[gangserver@localhost ~]$ sudo systemctl start mariadb
[gangserver@localhost ~]$ 

 

 

Check MariaDB processes

$ ps -ef | grep mysql

 

[ Execution log ]
[gangserver@localhost ~]$ ps -ef | grep mysql
mysql      12741       1  0 11:58 ?        00:00:00 /usr/libexec/mariadbd --basedir=/usr
gangser+   12890    9180  0 12:00 pts/2    00:00:00 grep --color=auto mysql

 

 

Initial setup (root password setting, etc.)

$ sudo mysql_secure_installation

 

[ Execution log ]

[gangserver@localhost ~]$ sudo mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):      <- Press Enter (enter root current password)
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] n     <- Enter Y to change to unix_socket authentication (enter n if you are not sure)
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y                  <- Enter Y to change the root password
New password:                                                 <- Enter the root password to change
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y                  <- To remove anonymous users, type Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y                <- Enter Y to disallow remote root login
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y        <- Enter Y to remove the test database and access to it
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y     <- Enter Y to reload the permission table now
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

 

MariaDB root login (login with the root password you changed above)

$ mariadb -u root -p

 

[ Execution log ]

[gangserver@localhost ~]$ mariadb -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.5.27-MariaDB 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)]> exit
Bye
[gangserver@localhost ~]$ 

반응형