All Products
Search
Document Center

:DROP DATABASE

Last Updated:Jun 25, 2024

AnalyticDB for MySQL allows you to execute the DROP DATABASE statement to delete a database.

Syntax

DROP DATABASE db_name [CASCADE]

Parameter

  • db_name: the name of the database.

  • CASCADE: forcibly deletes the database, including the tables, views, and materialized views in the database.

    Important
    • Only AnalyticDB for MySQL clusters of V3.2.1 or later allow you to use the CASCADE keyword to forcibly delete databases.

    • Before you delete a database from an AnalyticDB for MySQL cluster earlier than V3.2.1, you must first delete the tables, views, and materialized views from the database.

    For information about how to view and update the minor version of an AnalyticDB for MySQL cluster, see Update the minor version of a cluster.

Examples

  • Example 1: Delete the adb_demo database.

    DROP DATABASE adb_demo;  
  • Example 2: Forcibly delete the adb_demo1 database.

    DROP DATABASE adb_demo1 CASCADE;