문제

dThe following works as expected. But how do I insert the data into forth database instead of default "0" from command prompt?

# echo -n "testing" | /home/shantanu/redis-2.4.2/src/redis-cli -x set my_pass
OK

# echo -n "testing" | /home/shantanu/redis-2.4.2/src/redis-cli -x select 4; set my_pass
(error) ERR wrong number of arguments for 'select' command
도움이 되었습니까?

해결책

Just use the -n argument to choose DB number. It available since Redis 2.4.2.

echo -n "testing" | redis-cli -n 4 -x set my_pass

or

redis-cli -n 4 set my_pass testing

다른 팁

Launch the CLI by issuing command:

redis-cli

Then use the following command:

select <db number>

For example:

select 4
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top