DB/MariaDB

Ubuntu 26.04 MariaDB 설치 및 서비스 구동

강서버 2026. 5. 5. 01:28
728x90
반응형

1. 설치

 

2. 제거

 

 

설치

$ sudo apt install mariadb-server mariadb-client

 

[ 실행 로그 ]

gangserver@TCM73-U0424:~$ sudo apt install mariadb-server mariadb-client

[sudo: authenticate] 비밀번호:  

설치할 패키지:                                    
  mariadb-client  mariadb-server

설치할 의존성 패키지:
  galera-4          libfcgi-bin            mariadb-client-core            mariadb-plugin-provider-snappy
  gawk              libfcgi-perl           mariadb-common                 mariadb-server-core
  libaio1t64        libfcgi0t64            mariadb-plugin-provider-bzip2  mysql-common
  libcgi-fast-perl  libhtml-template-perl  mariadb-plugin-provider-lz4    pv
  libcgi-pm-perl    libmariadb3            mariadb-plugin-provider-lzma
  libdbi-perl       libpcre2-posix3        mariadb-plugin-provider-lzo

제안하는 패키지:
  gawk-doc            libsql-statement-perl    | libdbd-mysql-perl   mariadb-test
  libmldbm-perl       libipc-sharedcache-perl  libterm-readkey-perl  doc-base
  libnet-daemon-perl  libdbd-mariadb-perl      mailx

요약:
  업그레이드: 0, 설치: 24, 삭제: 0, 업그레이드 안 함: 0
  다운로드 크기: 17.8 MB
  필요한 공간: 127 MB / 1,543 MB 사용 가능

계속하시겠습니까? [Y/n] y

(... 로그 생략 ...)

내려받기 17.8 M바이트, 소요시간 4초 (4,504 k바이트/초)
패키지를 미리 설정하는 중입니다...
(데이터베이스 읽는중 ...현재 267812개의 파일과 디렉터리가 설치되어 있습니다.)
(... 로그 생략...)

 

 

- 설치 버전 확인

$ mariadb --version

 

[ 실행 로그 ]

gangserver@TCM73-U0424:~$ mariadb --version
mariadb from 11.8.6-MariaDB, client 15.2 for debian-linux-gnu (x86_64) using  EditLine wrapper

 

 

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

$ sudo systemctl enable --now mariadb

또는

$ sudo systemctl enable mariadb

$ sudo systemctl start mariadb

 

[ 실행 로그 ]

gangserver@TCM73-U0424:~$ sudo systemctl enable --now mariadb
[sudo: authenticate] 비밀번호:       
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

 

또는

 

gangserver@TCM73-U0424:~$ sudo systemctl enable mariadb
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'.

 

gangserver@TCM73-U0424:~$ sudo systemctl start mariadb
gangserver@TCM73-U0424:~$ 

 

 

- MariaDB 프로세스 확인

$ ps -ef | grep mysql

 

[ 실행 로그 ]

gangserver@TCM73-U0424:~$ ps -ef | grep mysql
mysql      24897       1  4 01:12 ?        00:00:02 /usr/sbin/mariadbd
gangser+   25008   23163  0 01:13 pts/1    00:00:00 grep --color=auto mysql

 

 

- 초기 설정

$ sudo mariadb-secure-installation

 

[ 실행 로그 ]

gangserver@TCM73-U0424:~$ sudo mariadb-secure-installation

NOTE: MariaDB is secure by default in Debian. Running this script is
      useless at best, and misleading at worst. This script will be
      removed in a future MariaDB release in Debian. Please read
      /usr/share/doc/mariadb-server/README.Debian.gz for details.

Enter root user password or leave blank:

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:                                   <- 변경할 root 비밀번호 재입력
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                  <- 익명 사용자 제거하려면 Y입력
SQL executed without errors!
The operation might have been successful, or it might have not done anything.

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] y        <- 테스트 데이터베이스와 그것으로의 액세스를 제거하려 Y입력
 - Dropping test database...
SQL executed without errors!
The operation might have been successful, or it might have not done anything.
 - Removing privileges on test database...
SQL executed without errors!
The operation might have been successful, or it might have not done anything.

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!

 

 

 

제거

 

$ sudo apt remove mariadb-server mariadb-client

$ sudo apt autoremove -y

 

[ 실행 로그 ]

gangserver@TCM73-U0424:~$ sudo apt remove mariadb-server mariadb-client
다음 패키지가 자동으로 설치되었지만 더 이상 필요하지 않습니다:
  galera-4          libcgi-pm-perl  libfcgi-perl           libmariadb3          mariadb-common                 mariadb-plugin-provider-lzma    mariadb-server-core
  libaio1t64        libdbi-perl     libfcgi0t64            libpcre2-posix3      mariadb-plugin-provider-bzip2  mariadb-plugin-provider-lzo     mysql-common
  libcgi-fast-perl  libfcgi-bin     libhtml-template-perl  mariadb-client-core  mariadb-plugin-provider-lz4    mariadb-plugin-provider-snappy  pv
'sudo apt autoremove'를 이용하여 제거하십시오.

제거할 패키지:
  mariadb-client  mariadb-server

요약:
  업그레이드: 0, 설치: 0, 삭제: 2, 업그레이드 안 함: 0
  비워진 공간: 71.2 MB

계속하시겠습니까? [Y/n] y
(데이터베이스 읽는중 ...현재 268601개의 파일과 디렉터리가 설치되어 있습니다.)
mariadb-server (1:11.8.6-5)를 제거합니다...
mariadb-client (1:11.8.6-5)를 제거합니다...
Processing triggers for man-db (2.13.1-1build1) ...

 

 

gangserver@TCM73-U0424:~$ sudo apt autoremove -y
제거할 패키지:                                    
  galera-4          libcgi-pm-perl  libfcgi-perl           libmariadb3          mariadb-common                 mariadb-plugin-provider-lzma    mariadb-server-core
  libaio1t64        libdbi-perl     libfcgi0t64            libpcre2-posix3      mariadb-plugin-provider-bzip2  mariadb-plugin-provider-lzo     mysql-common
  libcgi-fast-perl  libfcgi-bin     libhtml-template-perl  mariadb-client-core  mariadb-plugin-provider-lz4    mariadb-plugin-provider-snappy  pv

요약:
  업그레이드: 0, 설치: 0, 삭제: 21, 업그레이드 안 함: 0
  비워진 공간: 53.5 MB

(데이터베이스 읽는중 ...현재 268430개의 파일과 디렉터리가 설치되어 있습니다.)

(... 로그 생략 ...)

 

 

728x90
반응형