您的位置:首页 > 数据库 > MySQL

mysql字符集设置

2017-05-11 11:10 169 查看
mysql> show variables like 'char%' ;

+--------------------------+----------------------------+

| Variable_name | Value |

+--------------------------+----------------------------+

| character_set_client | utf8mb4 |

| character_set_connection | utf8mb4 |

| character_set_database | utf8mb4 |

| character_set_filesystem | binary |

| character_set_results | utf8mb4 |

| character_set_server | utf8mb4 |

| character_set_system | utf8 |

| character_sets_dir | /usr/share/mysql/charsets/ |

+--------------------------+----------------------------+

mysql> show variables like 'col%' ;

+----------------------+--------------------+

| Variable_name | Value |

+----------------------+--------------------+

| collation_connection | utf8mb4_general_ci |

| collation_database | utf8mb4_general_ci |

| collation_server | utf8mb4_general_ci |

[mysqld]

character_set_server = utf8mb4

#collation_server=utf8mb4_unicode_ci

character-set-client-handshake = FALSE

init_connect='SET NAMES utf8mb4'

[client]

default-character-set=utf8mb4

[mysql]

default-character-set=utf8mb4

设置字符集:

character_set_client :

1, The character set for statements that arrive from the client.

2, The session value of this variable is set using the character set requested by the client when the client connects to the server. (Many clients support a --default-character-set option to enable this character set to
be specified explicitly )

3, [mysql] default-character-set=utf8mb4

4,What character set is the statement in when it leaves the client?

The server takes the character_set_client system variable to be the character set in which

statements are sent by the client.

character_set_connection :

collation_connection:

1,It converts statements sent by the client from character_set_client
to character_set_connection

2,What character set should the server translate a statement to after receiving it?

3,SET NAMES 'charset_name'

4,[mysql] default-character-set = utf8mb4

character_set_database :

collation_database:

1,The character set used by the default database. The server sets this variable whenever the

default database changes. If there is no default database, the variable has the same value as

character_set_server .

2,The character set and collation for the default database can be determined from the values of the
character_set_database and
collation_database system variables。The server sets these

variables whenever the default database changes. If there is no default database, the variables have the same value as the corresponding server-level system variables,
character_set_server and
collation_server

character_set_filesystem :

1,The file system character set. This variable is used to interpret string literals that refer to file

names, such as in the LOAD DATA INFILE and
SELECT ... INTO OUTFILE statements and

the LOAD_FILE() function.
Such file names are converted from character_set_client to

character_set_filesystem before the file opening attempt occurs. The default value is binary,

which means that no conversion occurs. For systems on which multibyte file names are permitted, a different value may be more appropriate. For example, if the system represents file names using UTF-8, set
character_set_filesystem to 'utf8'.

character_set_results:

1,The character set used for returning query results such as result sets or error messages to the client.

2,If character_set_results is set to NULL, no conversion is performed and the server returns metadata using its original character set (the set indicated by character_set_system).
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: