title: PHP MySQLi query - "Permission denied"
body: <p>Im using PHP MySQLi to connect to MySQL and sometimes doing query i get error:</p>
  
  <blockquote>
    <p>"Permission denied" error code: 2002.</p>
  </blockquote>
  
  <p>The strange thing is that it happens for different query's and totally unpredictable. For example it might happen on third query after first two executed correctly.</p>
  
  <p>I know it is not problem with MySQL because i moved it from one server to another and problem still persists. Most likely problem with PHP or interconnection between PHP and MySQL servers (they're on different machines)</p>
  
  <p>Anyone got ideas?</p>
  
  <p>EDIT:<br />
  query what gets "Permission denied" works if i restart script - its not permissions problem</p>
  
  <p>ERROR:<br /></p>
  
  <blockquote>
    <p>[23-Apr-2011 19:00:02] PHP Warning: 
    mysqli::mysqli() [mysqli.mysqli]:
    [2002] Permission denied (trying to
    connect via
    tcp://xxx.xxx.xxx.xxx:3306) in
    /home/.../DB.php on line 19<br />
    [23-Apr-2011 19:00:02] PHP Warning: 
    mysqli::mysqli() [mysqli.mysqli]:
    (HY000/2002): Permission denied in
    /home/.../DB.php on line 19</p>
  </blockquote>