This topic describes how to modify a database in the MySQL mode of OceanBase Database by using an SQL statement.
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 tenant of the cluster.
Use the
ALTER DATABASEstatement to modify database attributes.Here is an example:
Change the character set of the
test2database toUTF8MB4, set the database collation toUTF8MB4_BIN, and set the database 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.