credochen 2011-09-21 23:16:16 6947次浏览 6条回复 0 0 0

exception 'CDbException' with message 'CDbConnection failed to open the DB connection: could not find driver' in

  • 回复于 2011-09-22 17:12 举报

    确实蛋疼…………

  • 回复于 2011-09-22 20:48 举报

    相当的不解。郁闷了,一直卡在那个地方。

  • 回复于 2012-02-05 14:34 举报

    把数据库连接字符串中的localhost改为127.0.0.1试试,如何?

  • 回复于 2012-02-17 17:14 举报

    找到config 文件再找到console.php文件,将里的配置写正确:如下

    // This is the configuration for yiic console application.
    // Any writable CConsoleApplication properties can be configured here.
    return array(
        'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
        'name'=>'My Console Application',
        // application components
        'components'=>array(
            'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=test',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            'tablePrefix' => 'tbl_',
            'enableParamLogging' => YII_DEBUG,//供debug使用
            'enableProfiling' => YII_DEBUG,//供debug使用
        ),
    ),
    );
    
  • 回复于 2012-02-17 17:15 举报

    如果用cmd与main.php配置无关的。只与console.php配置有关

您需要登录后才可以回复。登录 | 立即注册