How do I delete everything in Redis?
With redis-cli:
- FLUSHDB – Deletes all keys from the connection's current database.
- FLUSHALL – Deletes all keys from all databases.
For example, in your shell:
redis-cli flushall
Heads up that FLUSHALL
may be overkill. FLUSHDB
is the one to flush a database only. FLUSHALL
will wipe out the entire server. As in every database on the server. Since the question was about flushing a database I think this is an important enough distinction to merit a separate answer.
Answers so far are absolutely correct; they delete all keys.
However, if you also want to delete all Lua scripts from the Redis instance, you should follow it by:
SCRIPT FLUSH
The OP asks two questions; this completes the second question (everything wiped).