0
2

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 5 years have passed since last update.

MariaDB 10.1 設定

Posted at

はじめに

CentOS 7 minimal インストール ~ LAMP 構築まで

こちらは上の記事の続きとなります。

MariaDB 設定

MariaDB は MySQL の設定やコマンドがそのまま利用出来ます。
インストール直後は設定が存在していないのでサンプルをコピーします。

[root@localhost ~]# cp /usr/share/mysql/my-small.cnf /etc/my.cnf.d/server.cnf

文字化け対策

デフォルトだと日本語が文字化けしてしまうので以下の通り修正します。

[root@localhost ~]# vim /etc/my.cnf.d/server.cnf
[mysqld]
character-set-server = utf8   # この行を追加
[root@localhost ~]# systemctl restart mysqld.service
[root@localhost ~]# mysql -u root
MariaDB [(none)]> SHOW VARIABLES LIKE '%char%';
+--------------------------+----------------------------+
| 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)

MySQL サービスを再起動し文字コードが全て utf8 になっているか確認します。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?