---
slug: /turn-the-recyclebin-on-or-off
---

# Enable or disable the recycle bin

In seekdb, the recycle bin can be enabled or disabled by using the system variable `recyclebin`. By default, the recycle bin is disabled. If the recycle bin is enabled, after you drop a database object, the object is moved to the recycle bin.

## Background information

seekdb has global variables and session variables. When you enable or disable the recycle bin, you can choose the appropriate setting method based on your needs.

* Global variables: These are modifications at the global level. Different users in the database share global variables. Global variable modifications do not become invalid when a session ends. Additionally, global variable modifications do not take effect on sessions that are already open. You need to establish a new session for the changes to take effect.

* Session variables: These are modifications at the session level. After a client connects to the database, the database automatically generates session variables based on global variables. Session variable modifications only take effect on the current session.

## Procedure

1. Log in to seekdb as the administrator user `root`.

   The following example shows how to connect to the database. Please adjust the connection parameters based on your actual environment.

   ```shell
   mysql -h127.0.0.1 -uroot -P2881
   ```

2. Execute the following statement to view the recycle bin status.

   ```shell
   SHOW VARIABLES LIKE 'recyclebin';
   ```

   ```shell
   +---------------+-------+
   | Variable_name | Value |
   +---------------+-------+
   | recyclebin    | ON    |
   +---------------+-------+
   1 row in set
   ```

3. Choose an appropriate method to enable or disable the recycle bin based on your business needs.

   The variable `recyclebin` is a Boolean variable, so it supports multiple values. Specifically:

   * `on` 、`1` or `true`: Enables the recycle bin.

   * `off` 、`0` or `false`: Disables the recycle bin.

   * To enable or disable the recycle bin globally

     Global settings take effect throughout the entire seekdb database. After the settings are applied, they do not take effect on the current session. You need to log in again to establish a new session for the changes to take effect.

     The following statements are available:

     ```shell
     SET GLOBAL recyclebin = on;
     ```

     ```shell
     SET GLOBAL recyclebin = off;
     ```

     or

     ```shell
     SET GLOBAL recyclebin = 1;
     ```

     ```shell
     SET GLOBAL recyclebin = 0;
     ```

     or

     ```shell
     SET GLOBAL recyclebin = true;
     ```

     ```shell
     SET GLOBAL recyclebin = false;
     ```

   * To enable or disable the recycle bin for the current session

     Session settings only take effect on the current session.

     ```shell
     SET @@recyclebin = on;
     ```

     ```shell
     SET @@recyclebin = off;
     ```

     or

     ```shell
     SET @@recyclebin = 1;
     ```

     ```shell
     SET @@recyclebin = 0;
     ```

     or

     ```shell
     SET @@recyclebin = true;
     ```

     ```shell
     SET @@recyclebin = false;
     ```

## References

For more information about the recycle bin, see the following topics:

* [Overview of the recycle bin](../200.recyclebin/100.recyclebin-overview.md)

* [View recycle bin objects](../200.recyclebin/300.view-the-recyclebin-objects.md)

* [Purge the recycle bin](../200.recyclebin/500.purge-the-recyclebin.md)

* [Restore recycle bin objects](../200.recyclebin/400.restore-the-recyclebin-objects.md)