Yii Framework Forum: How To Change The Database - Yii Framework Forum

Jump to content

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

How To Change The Database

#1 User is offline   folta20 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 29-April 14

Posted 01 May 2014 - 11:04 PM

I want to change the database connection.. first, my app is connect to 'trackstar' database, and later i want to change to 'taskmanagement' database..

So i just simply change the dbname in my code :

<?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=taskmanagement',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
        ),
        'authManager'=>array(
            'class'=>'CDbAuthManager',
            'connectionID'=>'db',
            'itemTable' => 'tbl_auth_item',
            'itemChildTable' => 'tbl_auth_item_child',
            'assignmentTable' => 'tbl_auth_assignment',
        ),
    ),
);


but when i run the app i got error :

CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'trackstar.tbl_auth_assignment' doesn't exist. The SQL statement executed was: SELECT * FROM tbl_auth_assignment WHERE userid=:userid


the thing i dont understand is that why is still connect to trackstar database even though i just change the dbname to taskmanagement

thx before :)
0

#2 User is offline   nawin 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 15-March 14
  • Location:இந்தியா, தமிழ்நாடு (India,TamilNadu)

Posted 01 May 2014 - 11:19 PM

Hi look this topic :Dhere
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