w3resource

Redis Server: FLUSHDB

Redis FLUSHDB Command

Redis FLUSHDB command is used to delete all the keys of the currently selected DB. This command never fails.

Here are some common uses and scenarios for the "FLUSHDB" command:

  • Clear Current Database: Removes all keys from the currently selected database, clearing its data.
  • Testing: Useful for resetting the state of the current database during development or testing.
  • Maintenance: Facilitates data removal during maintenance tasks or before reconfiguring the database.
  • Data Purge: Provides a method to purge all data in a specific database when it is no longer needed.

Syntax:

FLUSHDB

Available since

1.0.0.

Return Value

String reply.

Return Value Type

String

Example: Redis FLUSHDB

redis 127.0.0.1:6379> FLUSHDB 
OK

Previous: FLUSHALL
Next: INFO



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/redis/redis-server-flushdb.php