deleteDatabase - Delete a database
The deleteDatabase() method is used to delete a database.
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.
-
If you use seekdb in server mode, make sure seekdb server mode is installed. For more information, see Deploy seekdb with package managers.
-
You are connected to the database. For more information, see SeekdbAdminClient.
-
The user to which you are connected has the
DROPprivilege. 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)
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
name | string | Yes | The name of the database to be deleted. | my_database |
tenant | string | No
| The tenant to which the database to be deleted belongs. | test_tenant |
Request example
import { SeekdbAdminClient } from "seekdb";
// Embedded mode - Database management (seekdb Embedded)
// const admin = new SeekdbAdminClient({ path: "./seekdb.db" });
// 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