Yii Framework Forum: yiic migrate gives CDbException "could not find driver" - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

yiic migrate gives CDbException "could not find driver" yiic migrate gives CDbException "could not find driver" Rate Topic: -----

#1 User is offline   kunalroy85 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 16-November 11

Posted 17 November 2011 - 05:39 AM

Hi,
I have been trying to create and execute the migration class for a database upgrade that I am trying for the first time. In the command prompt, I have been able to create the class file using the command :

yiic migrate create add_column_user


But when I run the command to upgrade the database,

yiic migrate


I get the following error on the console.

exception 'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driv
er' in F:\wamp\www\yii\framework\db\CDbConnection.php:364
Stack trace:
#0 F:\wamp\www\yii\framework\db\CDbConnection.php(313): CDbConnection->open()
#1 F:\wamp\www\yii\framework\db\CDbConnection.php(291): CDbConnection->setActive(true)
#2 F:\wamp\www\yii\framework\base\CModule.php(372): CDbConnection->init()
#3 F:\wamp\www\yii\framework\cli\commands\MigrateCommand.php(415): CModule->getComponent('db')
#4 F:\wamp\www\yii\framework\cli\commands\MigrateCommand.php(423): MigrateCommand->getDbConnection()
#5 F:\wamp\www\yii\framework\cli\commands\MigrateCommand.php(448): MigrateCommand->getMigrationHistory(-1)

#6 F:\wamp\www\yii\framework\cli\commands\MigrateCommand.php(75): MigrateCommand->getNewMigrations()
#7 [internal function]: MigrateCommand->actionUp(Array)


I have checked that PDO Mysql is installed, as I can see the module pdo_mysql by running the command

php -m


I can also connect to the mysql server from the command prompt.
Can anyone help me out what am I missing here?

Thanks!
Kunal
0

#2 User is offline   kunalroy85 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 16-November 11

Posted 18 November 2011 - 04:03 AM

View PostKunal Roy, on 17 November 2011 - 05:39 AM, said:

Hi,
I have been trying to create and execute the migration class for a database upgrade that I am trying for the first time. In the command prompt, I have been able to create the class file using the command :

yiic migrate create add_column_user


But when I run the command to upgrade the database,

yiic migrate


I get the following error on the console.

exception 'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driv
er' in F:\wamp\www\yii\framework\db\CDbConnection.php:364
Stack trace:
#0 F:\wamp\www\yii\framework\db\CDbConnection.php(313): CDbConnection->open()
#1 F:\wamp\www\yii\framework\db\CDbConnection.php(291): CDbConnection->setActive(true)
#2 F:\wamp\www\yii\framework\base\CModule.php(372): CDbConnection->init()
#3 F:\wamp\www\yii\framework\cli\commands\MigrateCommand.php(415): CModule->getComponent('db')
#4 F:\wamp\www\yii\framework\cli\commands\MigrateCommand.php(423): MigrateCommand->getDbConnection()
#5 F:\wamp\www\yii\framework\cli\commands\MigrateCommand.php(448): MigrateCommand->getMigrationHistory(-1)

#6 F:\wamp\www\yii\framework\cli\commands\MigrateCommand.php(75): MigrateCommand->getNewMigrations()
#7 [internal function]: MigrateCommand->actionUp(Array)


I have checked that PDO Mysql is installed, as I can see the module pdo_mysql by running the command

php -m


I can also connect to the mysql server from the command prompt.
Can anyone help me out what am I missing here?

Thanks!
Kunal


Found the problem. I had not configured the database component for the console in /protected/config/console.php
0

#3 User is offline   dbalencar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 17-November 10

Posted 27 November 2012 - 05:19 PM

View Postkunalroy85, on 18 November 2011 - 04:03 AM, said:

Found the problem. I had not configured the database component for the console in /protected/config/console.php


Thank you! The yii-user extension does not tell to configure the DB in console!!!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users