Skip to main content
Version: V1.4.1

Character sets

The default character set in seekdb is utf8mb4. seekdb supports the following character sets:

  • utf8mb4: Stores UTF-8-encoded Unicode characters, using up to four bytes per character.
  • binary: Treats strings as byte sequences.

View available character sets​

Use SHOW CHARACTER SET or SHOW CHARSET to view the character sets available on the current instance:

SHOW CHARACTER SET;

Example result:

+---------+-----------------------+--------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+-----------------------+--------------------+--------+
| binary | Binary pseudo charset | binary | 1 |
| utf8mb4 | UTF-8 Unicode | utf8mb4_general_ci | 4 |
+---------+-----------------------+--------------------+--------+
2 rows in set

Specify a character set​

You can specify a character set at the database, table, and character-column levels. For example:

CREATE DATABASE app CHARACTER SET utf8mb4;

CREATE TABLE app.t (
id INT PRIMARY KEY,
name VARCHAR(100) CHARACTER SET utf8mb4,
raw_value VARCHAR(100) CHARACTER SET binary
) DEFAULT CHARACTER SET utf8mb4;

For client connections, use utf8mb4:

SET NAMES utf8mb4;