Error Migrate

Good morning

I´m testing migrate, I created a new migrate ok, I create a method safeUp e safeDown to create a new table, but I had this error message:


exception ‘CDbException’ with message 'CDbConnection failed to open the DB conne

ction: could not find driver’ in C:\Program Files\Apache Software Foundation\Apa



I configureted the main db connection:


			'connectionString' => 'mysql:host=servidor:3306;dbname=migrate',

			'emulatePrepare' => true,

			'username' => 'root',

			'password' => '123456',

			'charset' => 'utf8',


This my migrate code:

class m110929_135042_tabela1 extends CDbMigration


	public function safeUp()


            $this->createTable('nova_tabela', array(

               'id' =>  'pk' ,

               'titulo' => 'string not null',

               'obs' => 'text' ,



	public function safeDown()





I have another aplications using Yii framework and database, my database is mysql.

Why this error?

Anybody knows? I researched but I did not found nothing

this is the same db config you have in main app ?

Yes is it

Is your db config you posted above defined in config/console.php?

Remember you are running console application when using migrate command.

Yes this is the problem. I did not know that I needed configure this file. Problem solved

Thanks for the help