keshaw
keshaw

Reputation: 1365

Redis-cli with password

I am using redis and trying to open CLI of redis using this:

$redis-cli -h 127.0.0.1 -p 6379 -a mysupersecretpassword

and getting and error :

(error) NOAUTH Authentication required

why so ?

Upvotes: 106

Views: 215558

Answers (6)

Jonno_FTW
Jonno_FTW

Reputation: 8809

You can pass --askpass and redis will prompt you to type in your password:

redis-cli -h 127.0.0.1 -p 6379 --askpass

Upvotes: 2

duckoak
duckoak

Reputation: 405

If you're using Redis Access Control List - ACL (Redis 6 and above), you log in with --user and --pass:

redis-cli -h 127.0.0.1 -p 6379 --user redis_user --pass 'redis_password'

or if you are already in redis-cli console you can authenticate with:

auth redis_user 'redis_password'

Upvotes: 6

Dedy Chaidir
Dedy Chaidir

Reputation: 927

Maybe this would usefull to someone. If you have already open the redis-cli console window, you can type the authentication like this:

auth 'your-password'

and then the console would response with OK

Upvotes: 18

Keshaw_pathak
Keshaw_pathak

Reputation: 662

If you have a '$' in your password then it won't work. So set the password without the "$".

Upvotes: 26

Vincente
Vincente

Reputation: 1137

My solution is put the password in single quotes like:

$redis-cli -h 127.0.0.1 -p 6379 -a 'thisizmy!PASS' 

Upvotes: 112

Shankar
Shankar

Reputation: 2825

If you have '$' in your password, make sure to enclose the password with single quotes. Then it will work.

Upvotes: 20

Related Questions