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 the privileges of the current user, see View user privileges. If you do not have the ALTER privilege, contact the administrator. For information about how to grant privileges to a user, see Modify user privileges.
Procedure
Log on 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 database
test2toUTF8MB4, 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.