23
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ubuntu 18.04 LTS に MariaDB 10.4 をインストール

Last updated at Posted at 2018-08-17

Ubuntu 18.04 LTS に MariaDB 10.4 をインストールしてみます。

MariaDB レポジトリ設定

MariaDB Package Repository Setup and Usage に記載されているワンライナーでレポジトリを設定します。

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

以下のファイルが生成されます。MariaDB Server 10.3 を利用したい場合は バージョン番号を変更してください。

/etc/apt/sources.list.d/mariadb.list
# MariaDB Server
deb http://downloads.mariadb.com/MariaDB/mariadb-10.4/repo/ubuntu bionic main

# MariaDB MaxScale
deb http://downloads.mariadb.com/MaxScale/2.4/ubuntu bionic main

# MariaDB Tools
deb http://downloads.mariadb.com/Tools/ubuntu bionic main

お約束の apt-get update / upgrade を実行します。

# apt-get -y update 
# apt-get -y upgrade 

mariadb-server-10.4 をインストール

apt list でパッケージ名を確認します。

# apt list | grep -i mariadb-server
mariadb-server/unknown 1:10.4.12+maria~bionic all
mariadb-server-10.1/bionic-updates,bionic-security 1:10.1.44-0ubuntu0.18.04.1 amd64
mariadb-server-10.4/unknown 1:10.4.12+maria~bionic amd64
mariadb-server-core-10.1/bionic-updates,bionic-security 1:10.1.44-0ubuntu0.18.04.1 amd64
mariadb-server-core-10.4/unknown 1:10.4.12+maria~bionic amd64

mariadb-server-10.4 をインストールします。

# apt install mariadb-server-10.4 -y

dpkg -lでインストールされたパッケージを確認します。

# dpkg -l | grep -i mariadb
ii  libdbd-mysql-perl              4.046-1                                     amd64        Perl5 database interface to the MariaDB/MySQL database
ii  libmariadb3:amd64              1:10.4.12+maria~bionic                      amd64        MariaDB database client library
ii  mariadb-client-10.4            1:10.4.12+maria~bionic                      amd64        MariaDB database client binaries
ii  mariadb-client-core-10.4       1:10.4.12+maria~bionic                      amd64        MariaDB database core client binaries
ii  mariadb-common                 1:10.4.12+maria~bionic                      all          MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
ii  mariadb-server-10.4            1:10.4.12+maria~bionic                      amd64        MariaDB database server binaries
ii  mariadb-server-core-10.4       1:10.4.12+maria~bionic                      amd64        MariaDB database core server files
ii  mysql-common                   1:10.4.12+maria~bionic                      all          MariaDB database common files (e.g. /etc/mysql/my.cnf)

MariaDB monitorを実行

mariadb(MariaDB monitor)コマンドを実行してみます。

# mariadb
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 47
Server version: 10.4.12-MariaDB-1:10.4.12+maria~bionic-log mariadb.org binary distribution

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)]> SELECT CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)) FROM mysql.global_priv \G
*************************** 1. row ***************************
CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)): root@localhost => {
    "access": 18446744073709551615,
    "plugin": "mysql_native_password",
    "authentication_string": "invalid",
    "auth_or":
    [

        {
        },

        {
            "plugin": "unix_socket"
        }
    ]
}
*************************** 2. row ***************************
CONCAT(user, '@', host, ' => ', JSON_DETAILED(priv)): mysql@localhost => {
    "access": 18446744073709551615,
    "plugin": "mysql_native_password",
    "authentication_string": "invalid",
    "auth_or":
    [

        {
        },

        {
            "plugin": "unix_socket"
        }
    ]
}

MariaDB 10.4 以降,root/mysql ユーザに対して unix_socket プラグインが有効にされていています。

以下のようにユーザ作成すれば,mysql_native_password プラグインを用いてユーザ認証されます。

MariaDB [(none)]> GRANT ALL ON *.* TO db_user@'localhost' IDENTIFIED BY 'password';
23
28
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?