How To Delete All Data in Redis

Channel: Linux
Abstract: Specify a database name with FLUSHDB to delete all data/keys of the specified Redis database. Each Redis database refers to a unique numeric index num

Redis provides CLI utility to manage Redis databases through the command line. It provides two commands FLUSHDB and FLUSHALL to flush database cache and remove all keys on Redis databases.

  • FLUSHALL – Used to delete all keys from all databases on Redis server.
  • FLUSHDB – Used to delete all keys of currently selected database or specified database.
Delete All Data on Redis
  • To Delete all data/keys of all Redis databases use FLUSHALL command.
    redis-cli FLUSHALL 
    
  • Delete all data/keys of the currently selected Redis database using FLUSHDB.
    redis-cli FLUSHDB
    
  • Specify a database name with FLUSHDB to delete all data/keys of the specified Redis database. Each Redis database refers to a unique numeric index number.
    redis-cli -n database_index FLUSHDB
    

Ref From: tecadmin
Channels: redis-cliredis

Related articles