我可以在像mysql这样的memcached上设置用户名和密码吗?

我可以在像mysql这样的memcached上设置用户名和密码吗?

问题描述:

I installed memcached and php-memcached on my ubuntu, I can connect to it by localhost on 11211 port. I can store data in it,but I wanna set username and password on it like when I connect to database. is it possible?how?

我在我的ubuntu上安装了memcached和php-memcached,我可以通过11211端口上的localhost连接到它。 I 可以在其中存储数据,但我想在其上设置用户名和密码,就像我连接数据库一样。 有可能吗?怎么样? p> div>

sasl_pwdb for more simple auth deployments

--enable-sasl-pwdb allows memcached to use it's own password file and verify a plaintext password. The file is specified with the environment variable MEMCACHED_SASL_PWDB, and is a plain text file with the following syntax:

username:password

Please note that you have to specify mech_list: plain in your sasl config file for this to work. Ex:

 echo "mech_list: plain" > memcached.conf
 echo "myname:mypass" > /tmp/memcached-sasl-db
 export MEMCACHED_SASL_PWDB=/tmp/memcached-sasl-db
 export SASL_CONF_PATH=`pwd`/memcached.conf
./memcached -S -v

and you should be able to use your favorite memcached client with sasl support to connect to the server. (Please note that not all SASL implementations support SASL_CB_GETCONF, so you may have to install the sasl config (memcached.conf) to the systemwide location)