Connection Select
# Redis Select Command
* (javascript:void(0);)
* (javascript:void(0);)
* (javascript:void(0);)
* (javascript:void(0))
Redis Tutorial
(#)(#)(#)(#)(#)
## Redis Commands
(#)(#)(#)(#)(#)(#)(#)(#)[Redis Pub/Sub](#)(#)(#)(#)(#)(#)(#)
## Redis Advanced Tutorial
(#)(#)(#)(#)(#)(#)(#)(#)
[](#)(#)
(#)[](#)
# Redis Select Command
!(#)(#)
The Redis SELECT command is used to switch to the specified database. The database index `index` is specified as a numeric value, starting from 0.
### Syntax
The basic syntax of the Redis SELECT command is as follows:
redis 127.0.0.1:6379> SELECT index
### Available Versions
>= 1.0.0
### Return Value
Always returns OK.
### Example
redis 127.0.0.1:6379> SET db_number 0 # Default uses database 0 OK redis 127.0.0.1:6379> SELECT 1 # Use database 1 OK redis 127.0.0.1:6379> GET db_number # Already switched to database 1; note that Redis's current prompt now includes (nil) redis 127.0.0.1:6379> SET db_number 1 OK redis 127.0.0.1:6379> GET db_number "1" redis 127.0.0.1:6379> SELECT 3 # Switch again to database 3 OK redis 127.0.0.1:6379> # Prompt changed from to
!(#)(#)
YouTip