This topic describes the statements and methods for creating a database in MySQL-compatible mode.
Prerequisites
You have the CREATE privilege. For information about how to view the privileges of the current user, see View user privileges. If you do not have the CREATE 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
CREATE DATABASEstatement to create a database.Example:
Create a database named
test2and specify the character set asUTF8.obclient> CREATE DATABASE test2 DEFAULT CHARACTER SET UTF8;Create a database named
test3that supports read and write operations.obclient> CREATE DATABASE test3 READ WRITE;Create a read-only database named
test4.obclient> CREATE DATABASE test4 READ ONLY;
References
For more information about the syntax of the CREATE DATABASE statement, see CREATE DATABASE.