MariaDB character setをUTF8にするコマンド
MariaDB/MySQLの文字コードセットがこんな感じだったとする。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
mysql> show variables like '%char%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | binary | | character_set_connection | binary | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | binary | | character_set_server | binary | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec) mysql> |
ここでこれを打つ。
1 2 3 |
set character_set_client = utf8; set character_set_connection = utf8; set character_set_results = utf8; |
するとこうなる。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
mysql> 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 | binary | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec) mysql> |
UTF8になったね!はっぴー!!