This topic describes how to modify a database by using the ALTER DATABASE statement.
Prerequisites
Ensure the current user has the ALTER privilege. For information about how to view your privileges, see View user privileges. If you do not have the ALTER privilege, contact the administrator to grant it. For information about how to grant privileges, see Grant privileges directly.
Procedure
Log in to a user tenant of the cluster.
Use the
ALTER DATABASEstatement to modify database attributes.Example:
Change the character set of the
test2database toUTF8MB4, set the collation toUTF8MB4_BIN, and set the database attribute to read/write.obclient> ALTER DATABASE test2 DEFAULT CHARACTER SET UTF8MB4;obclient> ALTER DATABASE test2 DEFAULT COLLATE UTF8MB4_BIN;obclient> ALTER DATABASE test2 READ WRITE;
References
For more information about the syntax of the ALTER DATABASE statement, see ALTER DATABASE.