title: Yii2 exception 'yii\db\Exception' with message 'could not find driver'
body: <p>I have an advanced yii2 template. I'm trying to create a console command.
  I've created a controller class  and action incide console/controllers folder:</p>
  
  <pre><code>namespace console\controllers;
  
  use yii\console\Controller;
  
  class WorkModelController extends Controller
  {
      public function actionValidate(){}
  }
  </code></pre>
  
  <p>My action should connect with mysql database, select some data and do something with it. When I running the command: yii work-model/validate I get this error: </p>
  
  <blockquote>
    <p>C:\OSPanel\domains\localhost>yii work-model/validate Exception
    'yii\db\Exception' with message 'could not find driver'</p>
    
    <p>in
    C:\OSPanel\domains\localhost\vendor\yiisoft\yii2\db\Connection.php:56</p>
  </blockquote>
  
  <p>My console/config/main.php and main-local.php files contain next db-config: </p>
  
  <pre><code>'components' =&gt; [
          'db' =&gt; [
              'class' =&gt; 'yii\db\Connection',
              'dsn' =&gt; 'mysql:host=localhost;dbname=dbname',
              'username' =&gt; 'root',
              'password' =&gt; '',
              'charset' =&gt; 'utf8',
          ],
  ];
  </code></pre>
  
  <p>When I trying connect to the database from another part of app all works fine, but when I trying connect from console I get this error.</p>
  
  <p>Please, help me slove this error. </p>