w3resource

Redis Connection: AUTH password

Redis AUTH Command

Redis AUTH command is used to authenticate to the server with given password. If 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.

Syntax:

Basic syntax of redis AUTH command is shown below:

redis 127.0.0.1:6379> AUTH PASSWORD

Return Value:

String reply

Example:

redis 127.0.0.1:6379> AUTH PASSWORD
(error) ERR Client sent AUTH, but no password is set
redis 127.0.0.1:6379> CONFIG SET requirepass "mypass"
OK
redis 127.0.0.1:6379> AUTH mypass
Ok


Follow us on Facebook and Twitter for latest update.