You can execute the CREATE DATABASE statement to create a database.

Create a database

Note You can create up to 256 databases in each AnalyticDB for MySQL cluster.
  • Syntax
    CREATE DATABASE [IF NOT EXISTS] db_name          
  • Parameters

    db_name: the name of the database. The 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 You cannot name a database as analyticdb because it is the name of a built-in database.
  • Example
    CREATE DATABASE adb_demo;          

Use a database

You can execute the USE db_name statement to use a database after it is created.

  • Syntax
    USE db_name       
  • Example
    use adb_demo;
    show tables;
    | Tables_in_adb_demo           |
    | customer                     |
    | test_table                   |