This topic describes how to create a database in MySQL mode by using an SQL statement.
Prerequisites
Ensure that you have the CREATE privilege. For information about how to view your privileges, see View user privileges. To acquire the CREATE 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
CREATE DATABASEstatement to create a database.Examples:
Create a database named
test2and specify the character set asUTF8.obclient> CREATE DATABASE test2 DEFAULT CHARACTER SET UTF8; Query OK, 1 row affectedCreate a database named
test3that supports read and write operations.obclient> CREATE DATABASE test3 READ WRITE; Query OK, 1 row affectedCreate a read-only database named
test4.obclient> CREATE DATABASE test4 READ ONLY; Query OK, 1 row affected
More information
For more information about the syntax of the CREATE DATABASE statement, see CREATE DATABASE.