# Specifying Character Set and Collation for Clusters

## Setting Character Set and Collation Engine Variables

Specify the character set for the cluster by setting the `character_set_server` engine variable.

Specify the collation for the cluster by setting one of the `collation_connection`, `collation_database`, and `collation_server` engine variables.

> **❗ Important**: Although these variables are session variables, these variables must be set globally to avoid undesired behavior. If one of these variables is set in a session to a value that does not match the value set globally, an error is generated. Change the value globally first, then change it in the session to match.

## character\_set\_server

Controls the default character set of the cluster. Can be set to `utf8mb4`, `utf8`, or `binary`.

If `character_set_server` is set to a value that is different from its previous value, the associated collation variables `collation_connection`, `collation_database`, and `collation_server` are set to that character set’s default collation.

## collation\_connection, collation\_database, and collation\_server

Controls the default collation of the cluster. Can be set to the values returned by the [SHOW COLLATION](https://docs.singlestore.com/db/v9.1/reference/sql-reference/show-commands/show-collation.md) command.

When any of the `collation_connection`, `collation_database`, and `collation_server`, variables are set, the other two variables are set to the same value and the collation is applied to the nodes.

In addition, when any of these three variables is set, the variable `character_set_server` is set to a value that corresponds to the collation.

## Set character\_set\_server

To set the `character_set_server` variable cluster-wide, use the following instructions.

Using a SingleStore client, run `SET CLUSTER` (the equivalent of `SET GLOBAL`) to set the `character_set_server` variable across the cluster. For example:

```sql
SET CLUSTER character_set_server = 'utf8';

```

```output

Query OK, 0 rows affected (0.03 sec)

```

If the character\_set\_server variable is set using `SET CLUSTER` (or its equivalent `SET GLOBAL`) or `SET AGGREGATOR`, additionally run `FLUSH CONNECTION POOLS` on every aggregator node and restart the SQL session for the new value to take effect.

SingleStore offers commands to set engine variables cluster-wide, on all aggregator nodes, or on leaf nodes. Refer to [Sync Variables](https://docs.singlestore.com/db/v9.1/reference/configuration-reference/engine-variables/sync-variables.md) and [Engine Variables](https://docs.singlestore.com/db/v9.1/reference/configuration-reference/engine-variables.md) for more information.

## Set collation\_connection, collation\_database, and collation\_server

To set the collation variables cluster-wide, use the following instructions.

Using a SingleStore client, run `SET CLUSTER` (the equivalent of `SET GLOBAL`) to set the collation variable across the cluster. For example:

```sql
SET CLUSTER collation_server = 'utf8_general_ci';

```

```output

Query OK, 0 rows affected (0.03 sec)

```

If a collation variable is set using `SET CLUSTER` (or its equivalent `SET GLOBAL`) or `SET AGGREGATOR`, additionally run `FLUSH CONNECTION POOLS` on every aggregator node and restart the SQL session for the new value to take effect.

SingleStore offers commands to set engine variables cluster-wide, on all aggregator nodes, or on leaf nodes. Refer to [Sync Variables](https://docs.singlestore.com/db/v9.1/reference/configuration-reference/engine-variables/sync-variables.md) and [Engine Variables](https://docs.singlestore.com/db/v9.1/reference/configuration-reference/engine-variables.md) for more information.

> **⚠️ Warning**: The following SingleStore engine variables exist for backwards compatibility with MySQL and are non-operational in SingleStore. These variables are available for read only; they are not available for write.- `character_set_client`
> - `character_set_connection`
> - `character_set_database`
> - `character_set_filesystem`
> - `character_set_results`
> - `character_set_system`
> - `character_sets_dir`

## Reading Character Set and Collation Engine Variables

To retrieve values of the character set or the collation in current use, use the `@@` selector with the required variable in a `SELECT` statement.

```sql
SELECT @@collation_server;

```

```output

+--------------------+
| @@collation_server |
+--------------------+
| utf8mb4_bin        |
+--------------------+
1 row in set (0.00 sec)
```

## Collation Example

The following example shows that `utf8_general_ci` collation is case-insensitive. The output is 1, indicating that A and a match in this collation.

```sql
SET collation_connection = 'utf8_general_ci';
SELECT 'A' = 'a'; 

```

```output

+-----------+
|'A' = 'a'  |
+-----------+
| 1         | 
+-----------+

```

The following example shows that `utf8_bin` collation is case-sensitive. The output is 0, indicating that A and a do not match in this collation.

```sql
SET collation_connection = 'utf8_bin'; 
SELECT 'A' = 'a';

```

```output

+-----------+
|'A' = 'a'  |
+-----------+
| 0         | 
+-----------+

```

> **❗ Important**: Among the collations supported for the `utf8mb4` character set, SingleStore recommends `utf8mb4_unicode_ci` for accurate comparison and sorting of characters, especially when using characters from non-English international languages. While `utf8mb4_general_ci` improves the performance of comparing and sorting operations, the results may not be precise when using certain language characters.

***

Modified at: April 15, 2026

Source: [/db/v9.1/reference/sql-reference/character-encoding/specifying-character-set-and-collation-for-clusters/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/character-encoding/specifying-character-set-and-collation-for-clusters/)

(An index of the documentation is available at /llms.txt)
