English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

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

Basic syntax of the redis Flushall command is as follows:

redis 127.0.0.1:6379> FLUSHALL

Available Version

>= 1.0.0

Return Value

Always returns OK .

Online Examples

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 1 database
OK
redis 127.0.0.1:6379> DBSIZE # 1 number of keys in database
(integer) 6
redis 127.0.0.1:6379> FLUSHALL # Clear all databases' keys
OK
redis 127.0.0.1:6379> DBSIZE # Not only 1 database was cleared
(integer) 0
redis 127.0.0.1:6379> SELECT 0 # 0 database (and all other databases) as well
OK
redis 127.0.0.1:6379> DBSIZE
(integer) 0

 

Redis Server