This topic describes how to modify a database in MySQL mode by using an SQL statement.
Prerequisites
Ensure that you have the ALTER privilege. For information about how to view your privileges, see View user privileges. To acquire the ALTER privilege, contact the administrator. For more information about how to grant privileges to a user, see Modify user privileges.
Procedure
Log on to the MySQL tenant of the cluster.
Use the
ALTER DATABASEstatement to modify database attributes.Example:
Change the character set of the database
test2toUTF8MB4, set the database collation toUTF8MB4_BIN, and set the database read/write 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;
More information
For more information about the syntax of the ALTER DATABASE statement, see ALTER DATABASE.