TiDBTiDB Docs Dash 2024

Jan 9 - Jan 12 (UTC)
Join us to improve docs and win a prize!
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

The ALTER DATABASE statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.

See also

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.