MySQL Variables character_set_database 数据库 参数变量解释及正确配置使用
本站中文解释
character_set_database是MySQL的参数变量,用来定义要使用的数据库字符集。它可以帮助正确处理由不同字符集发送或接收的字符,从而避免发生乱码现象。
要设置character_set_database,需要打开MySQL的命令行并输入如下命令:
SET character_set_database=utf8mb4;
注意:您也可以使用其他可用的字符集,比如utf8、latin1、gbk等。
官方英文解释
character_set_database
System Variable | character_set_database |
---|---|
Scope | Global, Session |
Dynamic | Yes |
Type | String |
Default Value | latin1 |
Footnote | This option is dynamic, but should be set only by server. You should not set this variable manually. |
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
.
The global
character_set_database
and
collation_database
system
variables are deprecated in MySQL 5.7; expect
them to be removed in a future version of MySQL.
Assigning a value to the session
character_set_database
and
collation_database
system
variables is deprecated in MySQL 5.7 and
assignments produce a warning. You should expect the session
variables to become read only in a future version of MySQL and
assignments to produce an error, while remaining possible to
access the session variables to determine the database
character set and collation for the default database.