Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis-cli with password

Tags:

redis

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 ?

like image 755
keshaw Avatar asked Mar 02 '16 11:03

keshaw


People also ask

How use Redis command line with password?

Redis AUTH command is used to authenticate to the server with the given password. If the password matches the password in the configuration file, the server replies with the OK status code and starts accepting commands. Otherwise, an error is returned and the clients needs to try a new password.

How do I authenticate Redis?

When the authorization layer is enabled, Redis will refuse any query by unauthenticated clients. A client can authenticate itself by sending the AUTH command followed by the password. The password is set by the system administrator in clear text inside the redis. conf file.

How do I access Redis from command line?

To start Redis client, open the terminal and type the command redis-cli. This will connect to your local server and now you can run any command.

Which one is correct command to set password in Redis?

If you are looking for a simple but temporary solution to set a password for your Redis server, you can use the config set command.


2 Answers

My solution is put the password in single quotes like:

$redis-cli -h 127.0.0.1 -p 6379 -a 'thisizmy!PASS'  
like image 183
Vincente Avatar answered Oct 12 '22 03:10

Vincente


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

like image 27
Keshaw_pathak Avatar answered Oct 12 '22 04:10

Keshaw_pathak