This is a read-only copy of the MariaDB Knowledgebase generated on 2024-12-22. For the latest, interactive version please visit https://mariadb.com/kb/.

SET NAMES

语法

SET NAMES {'charset_name'
    [COLLATE 'collation_name'] | DEFAULT}

描述

这会设置character_set_clientcharacter_set_connectioncharacter_set_results,同时还会隐式地设置会话级的系统变量collation_connection为指定的字符集和排序规则。

这决定了client将语句发送给server端以及server端将语句执行结果返回给client端时使用的character set

COLLATE子句是可选的,如果不定义(或设置为DEFAULT),将使用字符集的默认排序规则default collation for the character set

See also

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.