# SET CHARACTER SET

## Syntax

```sql
SET {CHARACTER SET | CHARSET}
    {charset_name | DEFAULT}
```

## Description

Sets the [character\_set\_client](../../../../../server-management/variables-and-modes/server-system-variables#character_set_client) and [character\_set\_results](../../../../../server-management/variables-and-modes/server-system-variables#character_set_results) session system variables to the specified character set and [collation\_connection](../../../../../server-management/variables-and-modes/server-system-variables#collation_connection) to the value of [collation\_database](../../../../../server-management/variables-and-modes/server-system-variables#collation_database), which implicitly sets [character\_set\_connection](../../../../../server-management/variables-and-modes/server-system-variables#character_set_connection) to the value of [character\_set\_database](../../../../../server-management/variables-and-modes/server-system-variables#character_set_database).

This maps all strings sent between the current client and the server with the given mapping.

## Example

```sql
SHOW VARIABLES LIKE 'character_set\_%';
+--------------------------+--------+
| Variable_name            | Value  |
+--------------------------+--------+
| character_set_client     | utf8   |
| character_set_connection | utf8   |
| character_set_database   | latin1 |
| character_set_filesystem | binary |
| character_set_results    | utf8   |
| character_set_server     | latin1 |
| character_set_system     | utf8   |
+--------------------------+--------+

SHOW VARIABLES LIKE 'collation%';
+----------------------+-------------------+
| Variable_name        | Value             |
+----------------------+-------------------+
| collation_connection | utf8_general_ci   |
| collation_database   | latin1_swedish_ci |
| collation_server     | latin1_swedish_ci |
+----------------------+-------------------+

SET CHARACTER SET utf8mb4;

SHOW VARIABLES LIKE 'character_set\_%';
+--------------------------+---------+
| Variable_name            | Value   |
+--------------------------+---------+
| character_set_client     | utf8mb4 |
| character_set_connection | latin1  |
| character_set_database   | latin1  |
| character_set_filesystem | binary  |
| character_set_results    | utf8mb4 |
| character_set_server     | latin1  |
| character_set_system     | utf8    |
+--------------------------+---------+

SHOW VARIABLES LIKE 'collation%';
+----------------------+-------------------+
| Variable_name        | Value             |
+----------------------+-------------------+
| collation_connection | latin1_swedish_ci |
| collation_database   | latin1_swedish_ci |
| collation_server     | latin1_swedish_ci |
+----------------------+-------------------+
```

## See Also

* [Setting Character Sets and Collations](setting-character-sets-and-collations)
* [SET NAMES](set-names)

<sub>_This page is licensed: CC BY-SA / Gnu FDL_</sub>

{% @marketo/form formId="4316" %}
