Describe the bug

It used to be possible to connect to Redis using redis-cli and a connection URL with an empty username, like this:

redis-cli -u 'redis://:PASSWORD@localhost:6379/0'

However, this no longer seems to work with the redis-cli 7.0.12 I'm using right now and it responds with:

AUTH failed: WRONGPASS invalid username-password pair or user is disabled.

I found that this can be fixed by explicitly providing default as username as follows (by luck, since that doesn't appear to be documented anywhere):

redis-cli -u 'redis://default:PASSWORD@localhost:6379/0'

However, that seems to somewhat violate the backwards compatibility promise as described here.

To reproduce

See description.

Expected behavior

See description.

Additional information

N/A

Comment From: enjoy-binbin

ok, it see it was broken in 6.2 (#8048), and there was a discussion about it #9186

a quick comment: parseRedisUri parsed out an empty sdsempty as username, so the auth command become auth "" password, and since we treat "" as a valid username, so it return WRONGPASS invalid username-password pair or user is disabled.

need other member's opinions

Comment From: OvervCW

@enjoy-binbin Ah, I searched related issues via GitHub and Google but didn't find those, apologies for that.

Comment From: zuiderkwast

We should improve the documentation about redis URIs, both in the output of redis-cli --help and on the redis.io website (the redis-docs repo). Documentation PRs are welcome.

Comment From: lowgiant

@enjoy-binbin Added an explanation for redis-cli --help. I'm not sure if I did my first PR correctly. Can you please check? #12751

Comment From: zuiderkwast

As long as the password doesn't contain : this works I think:

redis-cli -u 'redis://PASSWORD@localhost:6379/0'

Comment From: OvervCW

@zuiderkwast True, but as also mentioned in this comment, I don't like that syntax very much because it deviates from the normal URI conventions.