This topic describes how to create a database in an AnalyticDB for MySQL cluster by executing the CREATE DATABASE statement after you connect to the cluster. You can connect to the cluster by using Data Management Service (DMS), a MySQL client such as Navicat for MySQL, DBeaver, DbVisualizer, and SQL Workbench/J, application code, or the MySQL command line tool.

Background information

In the following example, DMS is used to create a database.

Note You can create up to 256 databases in each AnalyticDB for MySQL cluster.

Procedure

  1. On the SQL INFORMATION_SCHEMA tab, enter the CREATE DATABASE statement in the SQL console to create a database.
    • Syntax: CREATE DATABASE [IF NOT EXISTS] db_name
    • Parameter description: db_name: the database name. A database name can be up to 64 characters in length and can contain letters, digits, and underscores (_). It must start with a lowercase letter and cannot contain consecutive underscores (_).
      Note Do not use analyticdb as the database name. The name analyticdb is reserved for a built-in database.
    • Example:
      create database adb_demo;                          
      create database if not exists adb_demo2;                         
  2. In the upper-left corner, click execute(F8) to create the database.