[MySQL]既存DBの文字コードをutf8mb4に変更する

LINEで送る
Pocket

show variables like "chara%";
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8mb4                    | 
| character_set_connection | utf8mb4                    | 
| character_set_database   | utf8                       | 
| character_set_filesystem | binary                     |
| character_set_results    | utf8mb4                    |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8mb4                    |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
  • 変更
alter table テーブル名 default character set utf8mb4;
  • collationも変更する場合
ALTER DATABASE db-name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Was this helpful?

0 / 0

コメントを残す 0

Your email address will not be published. Required fields are marked *