Easy Tutorial
❮ Strings Setrange Keys Renamenx ❯

Redis Flushall Command

Redis Server

The Redis Flushall command is used to clear the entire Redis server's data (delete all keys in all databases).

Syntax

The basic syntax for the redis Flushall command is as follows:

redis 127.0.0.1:6379> FLUSHALL

Available Versions

= 1.0.0

Return Value

Always returns OK.

Example

redis 127.0.0.1:6379> DBSIZE            # Number of keys in database 0
(integer) 9

redis 127.0.0.1:6379> SELECT 1          # Switch to database 1
OK

redis 127.0.0.1:6379> DBSIZE         # Number of keys in database 1
(integer) 6

redis 127.0.0.1:6379> flushall       # Clear all keys in all databases
OK

redis 127.0.0.1:6379> DBSIZE         # Database 1 is now empty
(integer) 0

redis 127.0.0.1:6379> SELECT 0       # Switch back to database 0 (and all other databases are also empty)
OK

redis 127.0.0.1:6379> DBSIZE
(integer) 0

Redis Server

❮ Strings Setrange Keys Renamenx ❯