CentOS 7 に MariaDB をインストールしたときのメモです。
インストール
# yum install mariadb-server mariadb-devel
初期設定
/etc/my.cnf.d/server.cnfに追記
[mysqld]
character-set-server = utf8
/etc/my.cnf.d/mysql-clients.cnfに追記
[mysql]
default-character-set = utf8
show-warnings
MariaDBを起動、自動起動する設定
# systemctl start mariadb.service
# systemctl status mariadb.service
# systemctl enable mariadb.service
パスワードなど設定
# mysql_secure_installation
: 省略
Enter current password for root (enter for none):
OK, successfully used password, moving on...
: 省略
: root パスワードの設定
Set root password? [Y/n] y
New password: xxxxxxxx
Re-enter new password: xxxxxxxx
: 省略
: anonymous users の削除
Remove anonymous users? [Y/n] y
: 省略
: リモートからの root ログイン禁止
Disallow root login remotely? [Y/n] y
: 省略
: テストデータベースの削除
Remove test database and access to it? [Y/n] y
: 省略
: 権限テーブルのリロード
Reload privilege tables now? [Y/n] y
: 省略
データベース、パスワード、キャラクタセットの確認
# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| root | 127.0.0.1 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| root | ::1 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
+------+-----------+-------------------------------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> show variables like 'character_set%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
MariaDB [(none)]> quit
Bye
#
確認バージョン
# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
# uname -srvo
Linux 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 GNU/Linux
# mysql --version
mysql Ver 15.1 Distrib 5.5.41-MariaDB, for Linux (x86_64) using readline 5.1