title: Db Error while connecting with Yii Db settings
body: <p>i am getting following error.</p>
  
  <pre><code>CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
  </code></pre>
  
  <p>and this is my Db setting,now i am new to Yii so i dont know if there are some other things that i should mention, so if there are any other do let me know i will paste them ASAP.</p>
  
  <p>
  
  <p>// This is the configuration for yiic console application.
  // Any writable CConsoleApplication properties can be configured here.</p>
  
  <pre><code>return array(
      'basePath'=&gt;dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
      'name'=&gt;'My Console Application',
  
      // preloading 'log' component
      'preload'=&gt;array('log'),
  
      // application components
      'components'=&gt;array(
  //      'db'=&gt;array(
  //          'connectionString' =&gt; 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
  //      ),
          // uncomment the following to use a MySQL database
  
          'db'=&gt;array(
              'connectionString' =&gt; 'mysql:host=localhost;dbname=mydb',
              'emulatePrepare' =&gt; true,
              'username' =&gt; 'root',
              'password' =&gt; '',
              'charset' =&gt; 'utf8',
          ),
  
          'log'=&gt;array(
              'class'=&gt;'CLogRouter',
              'routes'=&gt;array(
                  array(
                      'class'=&gt;'CFileLogRoute',
                      'levels'=&gt;'error, warning',
                  ),
              ),
          ),
      ),
  );
  </code></pre>