This topic describes the statements and methods for modifying a database in MySQL-compatible mode.
Prerequisites
You have 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 obtain the privilege. For more information, see Grant direct privileges.
Procedure
Log in to a MySQL-compatible 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 read/write attribute toREAD 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.