Chapter 5. MySQL
Server Administration来至MySql5.6 manual
character_set_client
Variable Name | character_set_client | ||
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
The character set for statements that arrive from the client. 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. See also Section 10.1.4, “Connection Character Sets and Collations”.) The global value of the variable is used to set the session value in cases when the client-requested value is unknown or not available, or the server is configured to ignore client requests:
-
The client is from a version of MySQL older than MySQL 4.1, and thus does not request a character set.
-
The client requests a character set not known to the server. For example, a Japanese-enabled client requests sjis when connecting to a server not configured with sjis support.
-
mysqld was started with the --skip-character-set-client-handshake option, which causes it to ignore client character set configuration. This reproduces MySQL 4.0 behavior and is useful should you wish to upgrade the server without upgrading all the clients.
ucs2, utf16, utf16le, and utf32 cannot be used as a client character set, which means that they also do not work for SET NAMES or SET CHARACTER SET.
Charcter_set_client参数用来指定客户端向服务器传输语句时使用的字符集。这个变量用来设置客户端连接服务器时使用的字符集(很多客户端支持--default-character-set
属性,用来显示指定字符集)。这个参数在全局变量设置时,用来给那些没有显示设置字符集(或者字符集不对)的客户端使用:Mysql4.1 之前版本不支持这个参数是使用系统默认值;服务器不能接受客户端字符集是使用全家默认值;Mysqld进程通过--skip-character-set-client-handshake 忽略设置时使用默认值。ucs2, utf16, utf16le, and utf32 不能被用作客户端字符集。
Variable Name | character_set_connection | ||
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
The character set used for literals that do not have a character set introducer and for number-to-string conversion.
这个参数用来做没有指定字符集字符的默认值,用来做数字到字符转换(直译不顺,没有理解意思,后记简单说明)
Variable Name | character_set_database | ||
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Footnote | This option is dynamic, but only the server should set this information. You should not set the value of this variable manually. | ||
Permitted Values | |||
Type | string |
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.
默认数据库使用的字符集。Sever在切换数据库的时候设置这个参数,如果没有默认数据库,这个参数值和character_set_server一样
Command-Line Format | --character-set-filesystem=name | ||
Option-File Format | character-set-filesystem | ||
Option Sets Variable | Yes, character_set_filesystem | ||
Variable Name | character_set_filesystem | ||
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
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 multi-byte 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'.
系统字符集,mysql访问文件的时候根据这个字符集找文件:比如load data infile 和 select … into outfile 语句及loca_file函数;在没有mysql打开文件前,将文件名从character_set_client to
character_set_filesystem转换。该参数默认值是binary,表示不需要进行转换。对使用多字节表示文件名的系统,设置其它字符集更合适。如系统使用utf-8字符集,这个参数也设置为utf8 。
Variable Name | character_set_results | ||
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
The character set used for returning query results such as result sets or error messages to the client.
这个参数用来指定服务器给客户端返回数据时使用的字符集。
Command-Line Format | --character-set-server | ||
Option-File Format | character-set-server | ||
Option Sets Variable | Yes, character_set_server | ||
Variable Name | character_set_server | ||
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
The server's default character set. Server默认字符集,如果建表的时候不指定字符集,就使用这个值。
character_set_systemVariable Name | character_set_system | ||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | string |
The character set used by the server for storing identifiers. The value is always utf8.
Server存储标识符使用的字符集,值是utf-8
Command-Line Format | --character-sets-dir=path | ||
Option-File Format | character-sets-dir=path | ||
Option Sets Variable | Yes, character_sets_dir | ||
Variable Name | character-sets-dir | ||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | directory name |
The directory where character sets are installed.
字符集文件存放的目录。一般不需要指定。
后记:
1. MySQL Server将请求数据从character_set_client转换为character_set_connection;
2. 操作前将请求数据从character_set_connection转换为内部操作字符集,其确定方法如下:
使用每个数据字段的CHARACTER SET设定值;
若上述值不存在,则使用对应数据表的DEFAULT CHARACTER SET设定值;
若上述值不存在,则使用对应数据库的DEFAULT CHARACTER SET设定值;
若上述值不存在,则使用character_set_server设定值。
3. 将操作结果从内部操作字符集转换为character_set_results。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15711267/viewspace-776126/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15711267/viewspace-776126/