Skip to main content
Version: V1.1.0

deleteDatabase - Delete a database

The deleteDatabase() method is used to delete a database.

info

This API can only be used when connected with SeekdbAdminClient. For more information about SeekdbAdminClient, see SeekdbAdminClient.

Prerequisites

  • You have installed seekdb-js. For more information, see Quick start.

  • You have installed the server mode of seekdb. For more information, see Deploy seekdb by using yum install.

  • You are connected to the database. For more information, see SeekdbAdminClient.

  • The user to which you are connected has the DROP privilege. For more information about how to view the privileges of the current user, see View user privileges. If the user does not have this privilege, contact the administrator to grant it. For more information about how to directly grant privileges, see Directly grant privileges.

Request parameters

deleteDatabase(name: string, tenant?: string)
ParameterTypeRequiredDescriptionExample value
namestringYesThe name of the database to be deleted.my_database
tenantstringNo
  • When using the server mode of seekdb, this parameter is not required.
  • When using OceanBase Database, this parameter is required. The default value is sys.
The tenant to which the database to be deleted belongs.test_tenant

Request example

import { SeekdbAdminClient } from "seekdb";

// Remote server mode - database management (seekdb Server)
const admin = new SeekdbAdminClient({
host: "127.0.0.1",
port: 2881,
user: "root",
password: ""
});

await admin.deleteDatabase("my_database");

Response parameters

None