title: can not access to database in moodle
body: <p>I am using <a href="http://www.moodle.org" rel="noreferrer">moodle</a> and I change location of my web site, but I am facing this error.</p>
  <p>My config.php is:</p>
  <pre><code>&lt;?php  /// Moodle Configuration File 
  
  unset($CFG);
  
  $CFG-&gt;dbtype    = 'mysql';
  $CFG-&gt;dbhost    = 'localhost';
  $CFG-&gt;dbname    = 'lightsys_test';
  $CFG-&gt;dbuser    = 'lightsys_test';
  $CFG-&gt;dbpass    = '123456a';
  $CFG-&gt;dbpersist =  false;
  $CFG-&gt;prefix    = 'mdl_';
  
  $CFG-&gt;wwwroot   = 'http://www.lightsystem.ir/aya/moodle';
  
  $CFG-&gt;dirroot   = '/home/lightsys/public_html/aya/moodle';
  $CFG-&gt;dataroot  = '/home/lightsys/public_html/aya/moodledata';
  $CFG-&gt;admin     = 'admin';
  
  $CFG-&gt;directorypermissions = 00777;  // try 02777 on a server in Safe Mode
  
  require_once(&quot;$CFG-&gt;dirroot/lib/setup.php&quot;);
  // MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
  // RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
  // /home/lightsys/public_html/aya/moodle/
  ?&gt;
  </code></pre>
  <p>And my error is:</p>
  <blockquote>
  <p>Error: Database connection failed.</p>
  <p>It is possible that the database is overloaded or otherwise not running properly.</p>
  <p>The site administrator should also check that the database details have been correctly specified in config.php</p>
  </blockquote>