SET [名前|文字セット]

ステートメントSET NAMESSET CHARACTER SET 、およびSET CHARSET 、現在の接続の変数character_set_clientcharacter_set_results 、およびcharacter_set_connectionを変更します。

あらすじ

SetNamesStmt:

SetNamesStmt

変数割り当てリスト:

VariableAssignmentList

変数の割り当て:

VariableAssignment

文字セット名:

CharsetName

文字列名:

StringName

文字セットKw:

CharsetKw

文字セット名またはデフォルト:

CharsetNameOrDefault

mysql> SHOW VARIABLES LIKE 'character_set%'; +--------------------------+--------------------------------------------------------+ | Variable_name | Value | +--------------------------+--------------------------------------------------------+ | character_sets_dir | /usr/local/mysql-5.6.25-osx10.8-x86_64/share/charsets/ | | character_set_connection | utf8mb4 | | character_set_system | utf8 | | character_set_results | utf8mb4 | | character_set_client | utf8mb4 | | character_set_database | utf8mb4 | | character_set_filesystem | binary | | character_set_server | utf8mb4 | +--------------------------+--------------------------------------------------------+ 8 rows in set (0.01 sec) mysql> SET NAMES utf8; Query OK, 0 rows affected (0.00 sec) mysql> SHOW VARIABLES LIKE 'character_set%'; +--------------------------+--------------------------------------------------------+ | Variable_name | Value | +--------------------------+--------------------------------------------------------+ | character_sets_dir | /usr/local/mysql-5.6.25-osx10.8-x86_64/share/charsets/ | | character_set_connection | utf8 | | character_set_system | utf8 | | character_set_results | utf8 | | character_set_client | utf8 | | character_set_server | utf8mb4 | | character_set_database | utf8mb4 | | character_set_filesystem | binary | +--------------------------+--------------------------------------------------------+ 8 rows in set (0.00 sec) mysql> SET CHARACTER SET utf8mb4; Query OK, 0 rows affected (0.00 sec) mysql> SHOW VARIABLES LIKE 'character_set%'; +--------------------------+--------------------------------------------------------+ | Variable_name | Value | +--------------------------+--------------------------------------------------------+ | character_set_connection | utf8mb4 | | character_set_system | utf8 | | character_set_results | utf8mb4 | | character_set_client | utf8mb4 | | character_sets_dir | /usr/local/mysql-5.6.25-osx10.8-x86_64/share/charsets/ | | character_set_database | utf8mb4 | | character_set_filesystem | binary | | character_set_server | utf8mb4 | +--------------------------+--------------------------------------------------------+ 8 rows in set (0.00 sec)

MySQLの互換性

TiDB のSET [NAMES|CHARACTER SET]ステートメントは MySQL と完全な互換性があります。互換性の違いが見つかった場合は、 バグを報告 .

こちらも参照

このページは役に立ちましたか?