diff --git a/src/redis-cli.c b/src/redis-cli.c index 17fb5339..07038838 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -916,7 +916,7 @@ static int cliSendCommand(int argc, char **argv, int repeat) { return REDIS_ERR; } else { /* Store database number when SELECT was successfully executed. */ - if (!strcasecmp(command,"select") && argc == 2) { + if (!strcasecmp(command,"select") && argc == 2 && config.last_cmd_type != REDIS_REPLY_ERROR) { config.dbnum = atoi(argv[1]); cliRefreshPrompt(); } else if (!strcasecmp(command,"auth") && argc == 2) {