0
0

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.

CentOS 7: MariaDB インストール手順

Posted at

とりあえず localhost で良いから利用したい方へ。

前提

  • sudo が利用可能であること。

手順

MariaDB セットアップ

  1. MariaDB をインストールする。

    $ sudo yum -y install mariadb-server
    (中略)
    
    インストール:
      mariadb-server.x86_64 1:5.5.68-1.el7
    
    依存性関連をインストールしました:
      mariadb.x86_64 1:5.5.68-1.el7
      perl.x86_64 4:5.16.3-299.el7_9
      perl-Carp.noarch 0:1.26-244.el7
      perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
      perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
      perl-DBD-MySQL.x86_64 0:4.023-6.el7
      perl-DBI.x86_64 0:1.627-4.el7
      perl-Data-Dumper.x86_64 0:2.145-3.el7
      perl-Encode.x86_64 0:2.51-7.el7
      perl-Exporter.noarch 0:5.68-3.el7
      perl-File-Path.noarch 0:2.09-2.el7
      perl-File-Temp.noarch 0:0.23.01-3.el7
      perl-Filter.x86_64 0:1.49-3.el7
      perl-Getopt-Long.noarch 0:2.40-3.el7
      perl-HTTP-Tiny.noarch 0:0.033-3.el7
      perl-IO-Compress.noarch 0:2.061-2.el7
      perl-Net-Daemon.noarch 0:0.48-5.el7
      perl-PathTools.x86_64 0:3.40-5.el7
      perl-PlRPC.noarch 0:0.2020-14.el7
      perl-Pod-Escapes.noarch 1:1.04-299.el7_9
      perl-Pod-Perldoc.noarch 0:3.20-4.el7
      perl-Pod-Simple.noarch 1:3.28-4.el7
      perl-Pod-Usage.noarch 0:1.63-3.el7
      perl-Scalar-List-Utils.x86_64 0:1.27-248.el7
      perl-Socket.x86_64 0:2.010-5.el7
      perl-Storable.x86_64 0:2.45-3.el7
      perl-Text-ParseWords.noarch 0:3.29-4.el7
      perl-Time-HiRes.x86_64 4:1.9725-3.el7
      perl-Time-Local.noarch 0:1.2300-2.el7
      perl-constant.noarch 0:1.27-2.el7
      perl-libs.x86_64 4:5.16.3-299.el7_9
      perl-macros.x86_64 4:5.16.3-299.el7_9
      perl-parent.noarch 1:0.225-244.el7
      perl-podlators.noarch 0:2.5.1-3.el7
      perl-threads.x86_64 0:1.87-4.el7
      perl-threads-shared.x86_64 0:1.43-6.el7
    
    完了しました!
    
  2. MariaDB が停止していることを確認する。

    $ sudo systemctl status mariadb -l
    ● mariadb.service - MariaDB database server
       Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
       Active: inactive (dead)
    
  3. MariaDB の自動起動設定を有効化する。

    $ sudo systemctl enable mariadb
    Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
    
  4. MariaDB を起動, 確認する。

    $ sudo systemctl start mariadb
    $ sudo systemctl status mariadb -l
    ● mariadb.service - MariaDB database server
       Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
       Active: active (running) since 金 2021-05-21 16:18:14 JST; 8s ago
      Process: 2951 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
      Process: 2867 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
     Main PID: 2950 (mysqld_safe)
       CGroup: /system.slice/mariadb.service
               ├─2950 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
               └─3115 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
    
     5月 21 16:18:12 CentOS7 mariadb-prepare-db-dir[2867]: MySQL manual for more instructions.
     5月 21 16:18:12 CentOS7 mariadb-prepare-db-dir[2867]: Please report any problems at http://mariadb.org/jira
     5月 21 16:18:12 CentOS7 mariadb-prepare-db-dir[2867]: The latest information about MariaDB is available at http://mariadb.org/.
     5月 21 16:18:12 CentOS7 mariadb-prepare-db-dir[2867]: You can find additional information about the MySQL part at:
     5月 21 16:18:12 CentOS7 mariadb-prepare-db-dir[2867]: http://dev.mysql.com
     5月 21 16:18:12 CentOS7 mariadb-prepare-db-dir[2867]: Consider joining MariaDB's strong and vibrant community:
     5月 21 16:18:12 CentOS7 mariadb-prepare-db-dir[2867]: https://mariadb.org/get-involved/
     5月 21 16:18:12 CentOS7 mysqld_safe[2950]: 210521 16:18:12 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
     5月 21 16:18:12 CentOS7 mysqld_safe[2950]: 210521 16:18:12 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
     5月 21 16:18:14 CentOS7 systemd[1]: Started MariaDB database server.
    

MariaDB ログイン, ログアウト

パスワードは設定されていないので, 空打ちで OK.

  1. MariaDB に root ユーザーでログインする。

    $ mysql -u root -p
    Enter password:
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 2
    Server version: 5.5.68-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)]>
    
  2. ログアウトする。

    )]> quit
    Bye
    

どっとはらい。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?