2016年12月18日日曜日

MariaDB install

これまではMySQLを利用していたのでMySQLをインストールしようと思ったが、CentOS 7からはMariaDBが標準のようなのでMariaDBをインストールすることにする。

MySQL特有の新機能を利用することもないのでMariaDBでも問題はないでしょう。

yum install mariadb
yum install mariadb-server

mariadb install log

mariadb-server install log

設定ファイルは/etc/my.cnf /etc/my.cnf.d以下の設定ファイルがインクルードされる形。

MariaDB(MySQL)の設定ファイルを編集する。

viで/etc/my.cnfを以下のように編集。

symbolic-links=0 の行の下に以下を追加
character-set-server = utf8

MariaDB起動前のメモリーの使用状況チェック。

$ free
              total        used        free      shared  buff/cache   available
Mem:        1006680       93508      520600        6816      392572      754860
Swap:       1044220           0     1044220

OS起動時にMariaDB(MySQL)を起動するように設定する。

自動起動の設定
# systemctl enable mariadb.service
起動
# systemctl start mariadb.service
確認
# systemctl status mariadb.service

MariaDB起動後のメモリーの使用状況チェック。

$ free
              total        used        free      shared  buff/cache   available
Mem:        1006680      171480      410328        6820      424872      676216
Swap:       1044220           0     1044220

mysql_secure_installationでMariaDB(MySQL)の初期設定を行う。

# mysql_secure_installation

Change the root password? [Y/n] Y              # rootパスワード設定 Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y                # 匿名ユーザを削除
Disallow root login remotely? [Y/n] Y          # root ユーザでのリモートからのログインを禁止
Remove test database and access to it? [Y/n] Y # test データベースを削除
Reload privilege tables now? [Y/n] Y           # 権限テーブルをリロード

MariaDB(MySQL)へのログイン確認

$ mysql -u root -p
Enter password:[MariaDBのrootパスワード]
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
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)]> \q
Bye

これまではphpMyAdminもインストールしていたが、滅多に利用しないし、セキュリティ気にしたりもインストールも面倒なので今回はインストールしないことにする。DBを操作する時は、SQLコマンドを直接打って操作する。

これでMariaDB(MySQL)インストール完了。

0 件のコメント:

コメントを投稿