Ubuntu에 최신 MariadB를 넣습니다.

6124 단어 UbuntuMariaDBtech
Ubuntu에 최신 MariaDB를 넣었을 때의 메모입니다.
앱으로 넣으면 낡은 것들이 들어가기 때문에 싫어하는 사람을 겨냥한 기사다.
대리 환경에서의 사람을 대상으로

컨디션


OS: Ubuntu Server 20.04.2 LTS

MarriaDB의 봉인 창고 추가 및 설치


참조: MariaDB Package Repository Setup and Usage - MariaDB Knowledge Base
# scriptを回すために必要らしい
$ sudo apt install apt-transport-https
$ curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

[info] Repository file successfully written to /etc/apt/sources.list.d/mariadb.list
[info] Adding trusted package signing keys...
[info] Running apt-get update...
[info] Done adding trusted package signing keys
이 지령만 설치할 수 있어 매우 편리하다.
당신은 위의 참고 사이트에서 각종 옵션을 지정할 수 있습니다.sudo apt update면 마리아 DB의 포장도 주웠다는 것을 알 수 있습니다.
$ sudo apt update
…
Get:X https://dlm.mariadb.com/repo/maxscale/latest/ubuntu focal InRelease 
Hit:X https://downloads.mariadb.com/MariaDB/mariadb-10.5/repo/ubuntu focal InRelease
Hit:X https://downloads.mariadb.com/Tools/ubuntu focal InRelease
MarriaDB의 서버 패키지를 설치합니다.
$ sudo apt install mariadb-server

MarriaDB가 실행 중인지 확인


마리아 DB는 시스템드로 실행되기 때문에 평소 명령으로 확인할 수 있다.
$ systemctl status mariadb

● mariadb.service - MariaDB 10.5.8 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: active (running) since dddd YYYY-MM-DD hh:mm:ss JST; Xmin XXs ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 12599 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 10 (limit: 4486)
     Memory: 69.5M
     CGroup: /system.slice/mariadb.service
             └─12599 /usr/sbin/mariadbd

마리아 DB의 초기 설정


참조: Ubuntu 20.04: MariaDB 설치 및 설정: Server Worldmysql_secure_installation 관리자 권한으로 수행됩니다.
$ 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)
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'.

# Unix_socketを使うかどうか
Switch to unix_socket authentication [Y/n] n
 ... skipping.

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

# rootパスワードを変えるかどうか
Change the root password? [Y/n] y
New password:
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
 ... Success!

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

# rootのリモートログインを無効にするかどうか
Disallow root login remotely? [Y/n] y
 ... 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
"/etc/mysql/mariadb.conf.d/50-server.cnf"
 - 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
 ... 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!

마리아 DB에 로그인


다음 명령을 사용하여 로그인할 수 있습니다.
$ mariadb -u root -p
Enter password: # さっき決めたrootパスワード

좋은 웹페이지 즐겨찾기