All Products
Search
Document Center

AnalyticDB:Create a database

Last Updated:Sep 11, 2024

After you connect to an AnalyticDB for MySQL cluster, you can use the CREATE DATABASE statement to create a database. This topic describes how to create a database in the Data Management (DMS) console by using the CREATE DATABASE statement.

Note

You can create up to 2,048 databases for each AnalyticDB for MySQL cluster.

Procedure

  1. Connect to an AnalyticDB for MySQL cluster by using DMS. Select the INFORMATION_SCHEMA system database and enter CREATE DATABASE on the SQLConsole tab.

    • Syntax: CREATE DATABASE [IF NOT EXISTS] $db_name.

    • Parameter description: The db_name parameter specifies the name of the database that you want to create. The name can be up to 64 characters in length and can contain letters, digits, and underscores (_). The name 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 built-in databases.

    • Examples:

      create database adb_demo;                          
      create database if not exists adb_demo2;                         
  2. In the upper-left corner of the SQLConsole tab, click Execute. The database is created.