English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Redis Select command is used to switch to the specified database, the database index number index is specified by a numeric value, with 0 as the starting index value.
Basic Syntax of Redis Select Command
redis 127.0.0.1:6379> SELECT index
>= 1.0.0
Always returns OK .
redis 127.0.0.1:6379> SET db_number 0 # Default to using 0 number database OK redis 127.0.0.1:6379> SELECT 1 # Use 1 Number Database OK redis 127.0.0.1:6379[1]> GET db_number # Already switched to 1 Number Database, note that the Redis command prompt now includes [1] (nil) redis 127.0.0.1:6379[1]> SET db_number 1 OK redis 127.0.0.1:6379[1]> GET db_number "1" redis 127.0.0.1:6379[1]> SELECT 3 # Switch to 3 Number Database OK redis 127.0.0.1:6379[3]> # Prompt changed to [1] Changed to [3]