「DB」カテゴリーアーカイブ

MySQL/MariaDBを/rootや/home以下へ設定している環境をアップデートした時にMySQL/MariaDBが起動出来なくなってしまう!?

私の環境で発生した問題です。
CentOS 8.x/Rocky Linux 8.xにMySQL/MariaDBをインストールし、データベースを/home以下へ保存していました。
容量とパーティションの関係でそうなったのですが、これがOS/MySQL/MariaDBアップデート時に悲劇を招きました。

無事アップデートを終えたかに見えた状態でOSを再起動してみると、データベースが起動していない!?
試しにサービスの起動を以下のコマンドで試みるも、起動してくれない。

systemctl start mariadb

/etc/my.cnf.d/に変更が行われているのではないかと疑ってみたが、どうやら関係はない。

結果はコレだった!!

/usr/lib/systemd/system/mariadb.service
もしくは
/usr/lib/systemd/system/mysql.service

この中で、バージョン情報などが変更されているのだが、以下の設定がデフォルトに戻っていた。

ProtectHome=true

この設定は、/rootや/home以下にデータベースを保存する設定をした際に変更した経緯がある。
アップデートによりファイルが更新されて、デフォルトに戻されていたのだ!

設定のバックアップファイルなどは残っておらず、結論として当該ファイルの内容は完全に初期化され、過去の設定は残っていなかった。

設定を以下の様に変更した。

ProtectHome=false

その後、以下のコマンドで設定を再読込みしサービスを起動したら正常に起動することが出来た。

systemctl daemon-reload 
systemctl start mariadb    

この問題をどう回避するべきなのだろう?
通常は発生しないがバグなのだろうか?仕様なのだろうか?
アップデート前に、sosreportなどで設定をバックアップしておくべきなのだろうか?
でも、バックアップを確認するのも大変ですよね。困った事象です。
お気をつけ下さい。。。。
と言いつつ、ここを見ている人は、既に嵌った人ですよね。
ご愁傷さまでしたm(__)m

MariaDBを外部から接続できるようにするCentOS 7

MariaDBを外部サーバからアクセスできるように設定する。

MariaDBは前回導入しましたが、外部からアクセスできるように設定を行います。

外部とは、同一ネットワーク内のサーバからのみアクセスを許可します。全公開するとセキュリティを考慮する必要が生じますので、同一ネットワーク内としています。

環境

CentOS 7.4
MariaDB 10.1

作業項目

  1. ファイアウォールでMariaDBのサービスを許可する。
  2. MariaDB内に外部からアクセスを許可するユーザを作成する。
  3. MariaDBの設定を確認・調整する。

ファイアウォール設定

ファイアウォールにMariaDBのアクセスを許可します。
以下のコマンドで設定します。

# firewall-cmd --permanent --add-service=mysql
# systemctl stop firewalld.service
# systemctl start firewalld.service

firewalldの再起動は以下のコマンドでもOK!

# systemctl reload firewalld.service

これでfirewalldにmysqlのサービスが許可されました。
mysqlとしましたが、MariaDBは内部にmysqlを含んでいると考えてください。そして、mysqlが許可されればMariaDBへの許可が済んだことになります。

MariaDB内に外部からアクセスを許可するユーザを作成する。

今回は、内部ネットワークなのでrootユーザと同じレベルで作成します。

# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 520
Server version: 10.1.31-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)]> GRANT ALL PRIVILEGES ON *.* TO root@"10.123.123.%" IDENTIFIED BY 'password' WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;

前回インストールしたMariaDBであれば、これだけでOKのはずです。

私が少し躓いたのは、間に物理的なファイアウォールやUTMを配したネットワークを経由した際に、そのハードルを越えるために設定を施す必要が生じたのですが、同一ネットワーク内であれば、ルータ代わりにUTMを使っている様な下手なことをしていなければこれでつながるはずです。

MariaDBの設定を確認・調整する。

基本的には必要ありませんが、/etc/my.confや/etc/my.conf.d/で設定しているconfファイルで、bind-addressを指定している場合には、その設定を見直す必要があります。

bind-addressで指定が行われている場合、外部からアクセスするアクセス元のIPアドレスを確認して登録します。

対象ファイルは
/etc/my.conf
それ以外は以下の様に確認しました。

# cd /etc/my.conf.d/
# grep bind-address *.conf

これで何か設定が行われていれば、以下の様に接続元のIPアドレスを追加します。

bind-address = 10.123.123.8

こんな感じです。

以上で完了です。

最後に確認

最後に確認方法ですが・・・・

外部のマシンから以下のコマンドを実行します。

# mysql -h MariaDBの設置されたホスト名もしくはIPアドレス -u root -p

これでアクセスできない場合には、もう一度設定をみなしましょう。
それでも接続できない場合は、ネットワークに問題があるのかも知れません。ネットワーク管理者に相談してみるのも方法かと思います。

 

CentOS 7 へMariaDB 10.1(最新)をインストール

CentOS 7 + MariaDB 最新版をインストール

2018年3月時点における環境は以下の通り。

CentOS 7.4
MariaDB 5.5

この状況ですと、MariaDBの最新版がインストールされていない状態になっています。
MariaDBには、「Galera Cluster」が提供されておりますが、10.1以降ではデフォルトで組み込まれる様になりました。
つまり、10.0までのバージョンでは個別インストールが必要となります。

また、MariaDBとMySQLのバージョン関係を見てみましょう。


MariaDBバージョン MySQQLバージョン
MariaDB5.5.x MysQl5.5
別途Galera Clusterをインストール。
MariaDB10.0.x Mysql5.6
別途Galera Clusterをインストール。
MariaDB10.1.x Mysql5.7を取り入れ、MariaDB独自機能あり。
Galera Clusterは組み込み済み。

正直、現時点でMySQL 5.5はちょっと古い。5.6もしくは5.7をインストールしたい。
デフォルトのCentOS 7ではMariaDB5.5に対応しており、MariaDB10.xをインストールするには別途独自のインストール設定を行わなければならない。

ジレンマはあるが、後々のことを考えると選択肢は新しいバージョンを適用したい。

MariaDB 10.1.xをインストールする!

旧パッケージの削除

まず、既にインストールされているMariaDB関連のパッケージを確認→削除する。

# yum list installed  | grep -i mariadb
mariadb-libs.x86_64              1:5.5.56-2.el7                      @base

確認すると、mariadb-libsがデフォルトでインストールされているので、これを削除する。

# yum remove mariadb-libs

リポジトリの準備

MariaDBの本家からインストールを行えるようにリポジトリを追加する。

以下のサイトでも紹介されています。

https://mariadb.com/kb/ja/yum/

まずリポジトリの定義を行います。
/etc/yum.repos.d/にMariaDB.repoを作成します。
内容は以下の通りです。

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

MariaDBをインストール

これでMariaDBをyumでインストールできる。

# yum install MariaDB-server MariaDB-client

確認してみます。

# yum list installed | grep -i mariadb
MariaDB-client.x86_64            10.1.31-1.el7.centos                @mariadb
MariaDB-common.x86_64            10.1.31-1.el7.centos                @mariadb
MariaDB-server.x86_64            10.1.31-1.el7.centos                @mariadb
galera.x86_64                    25.3.22-1.rhel7.el7.centos          @mariadb

これでインストール自体は完了です。

MariaDBの初期設定

MariaDBの初期設定を行います。
インストール直後の設定はほとんど何もされていない状態にあるようです。
そこで、インストール設定を行います。
まず、デフォルトの設定ファイルをバックアップしておきます。
#本家では推奨されているわけではないのですが、気持ち的にオリジナルを無くしてしまうのは気持ち悪いw

# cd /etc/my.cnf.d/
# cp -p server.cnf server.cnf_org

バックアップ出来たので、初期設定を行います。

# cp -p /usr/share/mysql/my-small.cnf /etc/my.cnf.d/server.cnf
cp: `/etc/my.cnf.d/server.cnf' を上書きしますか? y

文字コードの設定が行われていない状態なので、設定をします。
以下の項目を追記します。

[client]
default-character-set = utf8

[mysqld]
character-set-server = utf8

取りあえず、大まかな設定は済みました。
この後は、MariaDBを起動しMariaDBのセキュア設定を行う。

MariaDBの起動

MariaDBを起動する。

# systemctl start mariadb.service

注意!!

2018-06-15時点において、上記の設定方法ではMariaDBが正常に起動できません!
2019-03-31時点において、問題は無くなっていました。
以下、不要となった部分に取り消し線を入れておきます。

多分、MariaDBのインストーラーがバグっている様に思えます。

# systemctl start mariadb
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.

こんな感じのエラーが表示されます。更に要求されたコマンドを実行してみます。

# systemctl status mariadb
● mariadb.service - MariaDB 10.1.33 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: failed (Result: exit-code) since 木 2018-06-14 19:58:09 JST; 22s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 7780 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
  Process: 7729 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 7727 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 7780 (code=exited, status=1/FAILURE)

 6月 14 19:58:09 localhost.localdomain mysqld[7780]: 2018-06-14 19:58:09 139863650711808 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.39-83.1 started; log sequence number 1600607
 6月 14 19:58:09 localhost.localdomain mysqld[7780]: 2018-06-14 19:58:09 139863650711808 [Note] Plugin 'FEEDBACK' is disabled.
 6月 14 19:58:09 localhost.localdomain mysqld[7780]: 2018-06-14 19:58:09 139863650711808 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
 6月 14 19:58:09 localhost.localdomain mysqld[7780]: 2018-06-14 19:58:09 139863013713664 [Note] InnoDB: Dumping buffer pool(s) not yet started
 6月 14 19:58:09 localhost.localdomain mysqld[7780]: 2018-06-14 19:58:09 139863650711808 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
 6月 14 19:58:09 localhost.localdomain mysqld[7780]: 2018-06-14 19:58:09 139863650711808 [Note] Server socket created on IP: '::'.
 6月 14 19:58:09 localhost.localdomain systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE
 6月 14 19:58:09 localhost.localdomain systemd[1]: Failed to start MariaDB 10.1.33 database server.
 6月 14 19:58:09 localhost.localdomain systemd[1]: Unit mariadb.service entered failed state.
 6月 14 19:58:09 localhost.localdomain systemd[1]: mariadb.service failed.

対処方法は以下の通りです。

# yum remove mysql mysql-server
読み込んだプラグイン:fastestmirror, langpacks
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ MariaDB-client.x86_64 0:10.1.33-1.el7.centos を 削除
---> パッケージ MariaDB-server.x86_64 0:10.1.33-1.el7.centos を 削除
--> 依存性解決を終了しました。

依存性を解決しました

==================================================================================================================================================================================================================
 Package                                             アーキテクチャー                            バージョン                                                   リポジトリー                                   容量
==================================================================================================================================================================================================================
削除中:
 MariaDB-client                                      x86_64                                      10.1.33-1.el7.centos                                         @mariadb                                      172 M
 MariaDB-server                                      x86_64                                      10.1.33-1.el7.centos                                         @mariadb                                      450 M

トランザクションの要約
==================================================================================================================================================================================================================
削除  2 パッケージ

インストール容量: 622 M
上記の処理を行います。よろしいでしょうか? [y/N]y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  削除中                  : MariaDB-server-10.1.33-1.el7.centos.x86_64                                                                                                                                        1/2 
警告: /etc/my.cnf.d/server.cnf は /etc/my.cnf.d/server.cnf.rpmsave として保存されました。
  削除中                  : MariaDB-client-10.1.33-1.el7.centos.x86_64                                                                                                                                        2/2 
  検証中                  : MariaDB-server-10.1.33-1.el7.centos.x86_64                                                                                                                                        1/2 
  検証中                  : MariaDB-client-10.1.33-1.el7.centos.x86_64                                                                                                                                        2/2 

削除しました:
  MariaDB-client.x86_64 0:10.1.33-1.el7.centos                                                            MariaDB-server.x86_64 0:10.1.33-1.el7.centos                                                           

完了しました!
# cd /var/lib/mysql
# rm -R *
# yum install mysql mysql-server
読み込んだプラグイン:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * remi-safe: ftp.riken.jp
 * updates: ftp.iij.ad.jp
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ MariaDB-client.x86_64 0:10.1.33-1.el7.centos を インストール
---> パッケージ MariaDB-server.x86_64 0:10.1.33-1.el7.centos を インストール
--> 依存性解決を終了しました。

依存性を解決しました

==================================================================================================================================================================================================================
 Package                                              アーキテクチャー                             バージョン                                                 リポジトリー                                   容量
==================================================================================================================================================================================================================
インストール中:
 MariaDB-client                                       x86_64                                       10.1.33-1.el7.centos                                       mariadb                                        39 M
 MariaDB-server                                       x86_64                                       10.1.33-1.el7.centos                                       mariadb                                       104 M

トランザクションの要約
==================================================================================================================================================================================================================
インストール  2 パッケージ

総ダウンロード容量: 143 M
インストール容量: 622 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): MariaDB-10.1.33-centos73-x86_64-client.rpm                                                                                                                                          |  39 MB  00:00:28     
(2/2): MariaDB-10.1.33-centos73-x86_64-server.rpm                                                                                                                                          | 104 MB  00:00:44     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
合計                                                                                                                                                                              3.2 MB/s | 143 MB  00:00:44     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : MariaDB-client-10.1.33-1.el7.centos.x86_64                                                                                                                                        1/2 
  インストール中          : MariaDB-server-10.1.33-1.el7.centos.x86_64                                                                                                                                        2/2 
2018-06-14 20:39:46 140526705314048 [Note] /usr/sbin/mysqld (mysqld 10.1.33-MariaDB) starting as process 10479 ...
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: The InnoDB memory heap is disabled
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Compressed tables use zlib 1.2.7
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Using Linux native AIO
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Using SSE crc32 instructions
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Completed initialization of buffer pool
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2018-06-14 20:39:46 140526705314048 [Warning] InnoDB: New log files created, LSN=45781
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Doublewrite buffer not found: creating new
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: Doublewrite buffer created
2018-06-14 20:39:46 140526705314048 [Note] InnoDB: 128 rollback segment(s) are active.
2018-06-14 20:39:46 140526705314048 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-06-14 20:39:47 140526705314048 [Note] InnoDB: Foreign key constraint system tables created
2018-06-14 20:39:47 140526705314048 [Note] InnoDB: Creating tablespace and datafile system tables.
2018-06-14 20:39:47 140526705314048 [Note] InnoDB: Tablespace and datafile system tables created.
2018-06-14 20:39:47 140526705314048 [Note] InnoDB: Waiting for purge to start
2018-06-14 20:39:47 140526705314048 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.39-83.1 started; log sequence number 0
2018-06-14 20:39:47 140525919270656 [Note] InnoDB: Dumping buffer pool(s) not yet started
2018-06-14 20:39:50 140323583248640 [Note] /usr/sbin/mysqld (mysqld 10.1.33-MariaDB) starting as process 10510 ...
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

2018-06-14 20:39:50 140323583248640 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: The InnoDB memory heap is disabled
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: Compressed tables use zlib 1.2.7
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: Using Linux native AIO
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: Using SSE crc32 instructions
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: Completed initialization of buffer pool
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: 128 rollback segment(s) are active.
2018-06-14 20:39:50 140323583248640 [Note] InnoDB: Waiting for purge to start
2018-06-14 20:39:50 140323583248640 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.39-83.1 started; log sequence number 1616697
2018-06-14 20:39:50 140322805901056 [Note] InnoDB: Dumping buffer pool(s) not yet started
2018-06-14 20:39:53 139656371382528 [Note] /usr/sbin/mysqld (mysqld 10.1.33-MariaDB) starting as process 10540 ...
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

2018-06-14 20:39:53 139656371382528 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: The InnoDB memory heap is disabled
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: Compressed tables use zlib 1.2.7
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: Using Linux native AIO
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: Using SSE crc32 instructions
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: Completed initialization of buffer pool
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: 128 rollback segment(s) are active.
2018-06-14 20:39:53 139656371382528 [Note] InnoDB: Waiting for purge to start
2018-06-14 20:39:53 139656371382528 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.39-83.1 started; log sequence number 1616707
2018-06-14 20:39:53 139655584409344 [Note] InnoDB: Dumping buffer pool(s) not yet started

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:
'/usr/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
Get Involved
検証中 : MariaDB-server-10.1.33-1.el7.centos.x86_64 1/2 検証中 : MariaDB-client-10.1.33-1.el7.centos.x86_64 2/2 インストール: MariaDB-client.x86_64 0:10.1.33-1.el7.centos MariaDB-server.x86_64 0:10.1.33-1.el7.centos 完了しました! # systemctl start mariadb

まとめると、こんな感じ。

# yum remove myslq
# cd /var/lib/mysql
# rm -R *
# yum install mysql mysql-server
# systemctl start mariadb

なんか最初のインストールでゴミが出来てしまうのと、インストールに必要なプラグインが抜け落ちてる感じがします。
それを無理矢理、MySQLのパッケージを削除→ゴミも削除→再度インストール。。。という流れでしょうか?

最後に、MariaDBを再起動時にも起動するように設定するには、以下のコマンドを実行します。

# systemctl enable mariadb

セキュリティ設定

セキュリティ設定を行います。

# mysql_secure_installation
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
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):[リターン]

Set root password? [Y/n] y
New password:****
Re-enter new password:****

Remove anonymous users? [Y/n] y

Disallow root login remotely? [Y/n] y

Remove test database and access to it? [Y/n] y

Reload privilege tables now? [Y/n] y

※パスワードは適当に入力してください。

これでセキュリティ設定は完了です。

こんな感じで使えるようになります。