title: How to set password for Redis?
body: <p>I'm working with redis on my local machine  so I dont really need to set up a password to connect to the server with my php client (I'm using predis as a client). However, I'm moving my app to a live server, so I want to set up a password to connect to my redis server.</p>
  
  <p>I have few questions:</p>
  
  <ul>
  <li><p>I checked all over the internet about how to set up the password and it looks like I need to add the password in the redis.conf. I couldnt find though what I should add exactly to the configuration file to set up the password. </p></li>
  <li><p>also in predis how should I add the password. I'm using the following array of parameters to connect to the redis server </p>
  
  <blockquote>
    <p>$my_server = array('host'     => '127.0.0.1','port'     =>
    6379,'database' => 1); <br/></p>
  </blockquote></li>
  </ul>
  
  <p>should I add the password this way? </p>
  
  <pre><code>&gt; $my_server = array('host'     =&gt; '127.0.0.1','port'     =&gt;
  &gt; 6379,'database' =&gt; 1,'password'=&gt;password);
  </code></pre>
  
  <ul>
  <li><p>last question, I'm trying to stop my redis-server on the live server. Every time I enter the following command , I keep getting the same error message </p>
  
  <blockquote>
    <p>redis-server stop<br/></p>
    
    <p>[23925] 23 Sep 20:23:03 # Fatal error, can't open config file 'stop'</p>
  </blockquote>
  
  <p>usually on my local machine I enter </p>
  
  <blockquote>
    <p>/etc/init.d/redis-server stop</p>
  </blockquote></li>
  </ul>
  
  <p>to stop redis server but its not working on my live server since there is no process called redis-server in my /etc/init.d</p>