redis-lua icon indicating copy to clipboard operation
redis-lua copied to clipboard

missing password parameter in the connection

Open aztrock opened this issue 10 years ago • 5 comments

aztrock avatar Mar 30 '15 05:03 aztrock

you can use client:auth(password)

summershrimp avatar May 01 '15 02:05 summershrimp

redis = require 'redis' client = redis.connect('127.0.0.1', 6379) client.auth(password) /usr/local/share/lua/5.1/redis.lua:371: attempt to index field 'network' (a nil value) stack traceback: /usr/local/share/lua/5.1/redis.lua:371: in function 'send' /usr/local/share/lua/5.1/redis.lua:379: in function 'auth' stdin:1: in main chunk [C]: ?

aztrock avatar Dec 13 '15 22:12 aztrock

client:auth, not client.auth

summershrimp avatar Dec 14 '15 03:12 summershrimp

client:auth( password ) works for me, thanks a lot!

mosjin avatar Feb 21 '19 12:02 mosjin

Hey guys, there are a few different ways to authenticate with redis lua and the method shown above is just one of them.

When we configure redis to require a password by changing the redis.conf file and uncommenting the requirepass flag (# requirepass foobared) we use the auth method as below.

redis = require 'redis'
local password = 'mypass'
client = redis.connect('127.0.0.1', 6379)
client:auth(password)

However, if we use the acl with a username and password, we must authenticate as follows.

redis = require 'redis'
local password = 'mypass'
local user = 'myuser'
client = redis.connect('127.0.0.1', 6379)
client:auth(user, password)

I left some links to help if anyone is facing the same difficulties I went through

https://redis.io/commands/auth/ https://redis.io/docs/management/security/acl/

joaomateusferr avatar Feb 26 '23 15:02 joaomateusferr