Redis: Delete All Keys – Redis-CLI

In Redis you can flush cache/database and delete all keys from all databases or from the particular database only using FLUSHALL and FLUSHDB commands.

To delete all keys from all Redis databases, use the FLUSHALL command.

To delete all keys of the selected Redis database only, use the FLUSHDB commnad.

Cool Tip: List all keys from the all databases in Redis! Read more →

Delete All Keys In Redis

Delete all keys from all Redis databases:

$ redis-cli FLUSHALL

Delete all keys of the currently selected Redis database:

$ redis-cli FLUSHDB

Delete all keys of the specified Redis database:

$ redis-cli -n <database_number> FLUSHDB
Was it useful? Share this post with the world!

2 Replies to “Redis: Delete All Keys – Redis-CLI”

  1. Stavros Kefaleas says: Reply

    Awesome!

  2. Some info for a Redis cluster:
    For a cluster there is only one database and the FLUSHDB/FLUSHALL command has to be executed on *every* master.

Leave a Reply