最終更新日:2017年1月20日
MariaDB とは
MariaDB は、フリーで使えるデータベースサーバーです。
1. MariaDB をインストールする
以下のコマンドで MariaDB をインストールします。
# yum -y install mariadb-server mariadb-devel
2. MariaDB を起動する
以下のコマンドで MariaDB を起動・停止します。
# systemctl start mariadb (起動)
# systemctl stop mariadb (停止)
3. 初期設定を行う
以下のコマンドで対話式の初期設定を実行します。管理者 root ユーザーのパスワード設定、匿名ユーザーの削除、リモートからの root アクセス拒否、test データベースの削除などを行います。
基本的には既定のまま Enter で進めて問題ありません。ここではパスワードを passwd1 としています。
# mysql_secure_installation ...中略... Enter current password for root (enter for none):[セEnter] OK, successfully used password, moving on... ...中略... Set root password? [Y/n][セEnter] New password:passwd1 Re-enter new password:passwd1 Password updated successfully! ...中略... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
4. アクセスを確認する
以下のコマンドでアクセスを確認します。"Welcome to the MariaDB monitor." と表示され、バージョン番号が確認できれば成功です。
# mysql -u root -p Enter password:passwd1 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 9 Server version: 5.5.52-MariaDB MariaDB Server Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> exit;