OS/하모니카(HamoniKR) OS

하모니카(HamoniKR) 8 MariaDB 설치 및 서비스 구동

강서버 2025. 3. 27. 00:31
반응형

MariaDB 설치

$ sudo apt install mariadb-server mariadb-client

 

[ 실행 로그 ]

 ~  sudo apt install mariadb-server mariadb-client       ✔  at 00:13:40  
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다... 완료
상태 정보를 읽는 중입니다... 완료        
다음의 추가 패키지가 설치될 것입니다 :
  galera-4 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl
  libhtml-template-perl libmariadb3 libterm-readkey-perl mariadb-client-core
  mariadb-common mariadb-plugin-provider-bzip2 mariadb-plugin-provider-lz4
  mariadb-plugin-provider-lzma mariadb-plugin-provider-lzo
  mariadb-plugin-provider-snappy mariadb-server-core pv socat
제안하는 패키지:
  libmldbm-perl libnet-daemon-perl libsql-statement-perl
  libipc-sharedcache-perl mailx mariadb-test doc-base
다음 새 패키지를 설치할 것입니다:
  galera-4 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl
  libhtml-template-perl libmariadb3 libterm-readkey-perl mariadb-client
  mariadb-client-core mariadb-common mariadb-plugin-provider-bzip2
  mariadb-plugin-provider-lz4 mariadb-plugin-provider-lzma
  mariadb-plugin-provider-lzo mariadb-plugin-provider-snappy mariadb-server
  mariadb-server-core pv socat
0개 업그레이드, 19개 새로 설치, 0개 제거 및 1개 업그레이드 안 함.
17.1 M바이트 아카이브를 받아야 합니다.
이 작업 후 189 M바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까? [Y/n] y
(... Log omitted ...)

 

설치 버전 확인

$ mariadb --version

 

[ 실행 로그 ]

  ~  mariadb --version                                INT ✘  at 00:22:10  
mariadb  Ver 15.1 Distrib 10.11.8-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper

 

 

부팅 시 MariaDB 서비스 시작 및 바로 MariaDB 서비스 구동

$ sudo systemctl enable --now mariadb

또는

$ sudo systemctl enable mariadb           <- 부팅 시 MariaDB 서비스 시작

$ sudo systemctl start mariadb               <- MariaDB 서비스 구동

 

[ 실행 로그 ]

  ~  sudo systemctl enable --now mariadb                  ✔  at 00:24:17  
Synchronizing state of mariadb.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable mariadb
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

 

  ~  sudo systemctl enable mariadb                        ✔  at 00:23:11  
Synchronizing state of mariadb.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable mariadb
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

 

  ~  sudo systemctl start mariadb                         ✔  at 00:23:24  
  ~  

 

 

MariaDB 프로세스 확인

$ ps -ef | grep mysql

 

[ 실행 로그 ]

  ~  ps -ef | grep mysql                                  ✔  at 00:25:13  
mysql      18389       1  0 00:24 ?        00:00:00 /usr/sbin/mariadbd
gangser+   18593    8176  0 00:25 pts/0    00:00:00 grep --color=auto mysql

 

 

초기 설정 (root 비번 설정 등)

$ sudo mysql_secure_installation

 

[ 실행 로그 ]

  ~  sudo mysql_secure_installation                       ✔  at 00:25:45  

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):      <- 엔터 입력
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     <- unix_socket 인증으로 변경하려면 Y입력 (잘모르겠으면 n입력)
 ... skipping.

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

Change the root password? [Y/n] y                  <- root 비밀번호 변경하려면 Y입력
New password:                                                 <- 변경할 root 비밀번호 입력
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] n                  <- 익명 사용자 제거하려면 Y입력
 ... skipping.

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] n                <- 원격으로 root 로그인을 허용하지 않으려면 Y입력
 ... skipping.

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] n        <- 테스트 데이터베이스와 그것으로의 액세스를 제거하려 Y입력
 ... skipping.

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

Reload privilege tables now? [Y/n] y     <- 지금 권한 테이블을 다시 로드하려면 Y입력
 ... 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 로그인 (위에서 변경한 root 비밀번호로 로그인)

$ mariadb -u root -p

 

[ 실행 로그 ]

  ~  mariadb -u root -p                      ✔  took 38s   at 00:26:25  
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 35
Server version: 10.11.8-MariaDB-0ubuntu0.24.04.1 Ubuntu 24.04

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
  ~                                          ✔  took 28s   at 00:30:23  

 

 

728x90
반응형