Sign InTry Free

ALTER DATABASE

ALTER DATABASE is used to specify or modify the default character set and collation of the current database. ALTER SCHEMA has the same effect as ALTER DATABASE.

Synopsis

AlterDatabaseStmt
ALTERDATABASEDBNameDatabaseOptionList
DatabaseOption
DefaultKwdOptCharsetKw=CharsetNameCOLLATE=CollationNameENCRYPTION=EncryptionOpt

Examples

Modify the test database schema to use the utf8mb4 character set:

ALTER DATABASE test DEFAULT CHARACTER SET = utf8mb4;
Query OK, 0 rows affected (0.00 sec)

Currently, TiDB only supports some character sets and collations. See Character Set and Collation Support for details.

MySQL compatibility

This statement is understood to be fully compatible with MySQL. Any compatibility differences should be reported via an issue on GitHub.

See also

Download PDFRequest docs changesEdit this page
Was this page helpful?
Open Source Ecosystem
TiDB
TiKV
TiSpark
Chaos Mesh
© 2022 PingCAP. All Rights Reserved.