I am trying to use bake with cakephp. I have gotten to the cake welcome screen below:
Welcome to CakePHP v2.3.0-RC2 Console
---------------------------------------------------------------
App : app
Path: /Users/philip7899/Desktop/Philips Server 2/blog/app/
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
I type in C and it asks me about my database configuration:
Bake Controller
Path: /Users/philip7899/Desktop/Philips Server 2/blog/app/Controller/
---------------------------------------------------------------
Use Database Config: (default/test)
[default] >
I press enter to confirm using the "default" database configuration. I have pasted it below:
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => 'root',
'database' => 'cakephp_blog',
'prefix' => '',
//'encoding' => 'utf8',
);
I then receive the following errors:
Warning Error: PDO::__construct(): [2002] No such file or directory
(trying to connect via unix:///var/mysql/mysql.sock) in
[/Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Model/Datasource/Database/Mysql.php, line 157]
Error: Database connection "Mysql" is missing, or could not be created.
#0 /Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Model/Datasource/DboSource.php(261): Mysql->connect()
#1 /Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Model/ConnectionManager.php(101): DboSource->__construct(Array)
#2 /Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Console/Command/Task/ModelTask.php(903): ConnectionManager::getDataSource('default')
#3 /Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Console/Command/Task/ControllerTask.php(396): ModelTask->getAllTables('default')
#4 /Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Console/Command/Task/ControllerTask.php(419): ControllerTask->listAll(NULL)
#5 /Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Console/Command/Task/ControllerTask.php(136): ControllerTask->getName()
#6 /Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Console/Command/Task/ControllerTask.php(61): ControllerTask->_interactive()
#7 /Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Console/Command/BakeShell.php(113): ControllerTask->execute()
#8 /Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Console/Shell.php(391): BakeShell->main()
#9 /Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Console/ShellDispatcher.php(199): Shell->runCommand(NULL, Array)
#10 /Users/philip7899/Desktop/Philips Server 2/blog/lib/Cake/Console/ShellDispatcher.php(67): ShellDispatcher->dispatch()
#11 /Users/philip7899/Desktop/Philips Server 2/blog/app/Console/cake.php(33): ShellDispatcher::run(Array)
#12 {main}
I have spent the past several hours searching the internet and trying to figure this out and I haven't been able to fix it. I know the database configuration is working because the website itself is functioning perfectly. How can I get cake to work in the console and let me proceed? Thanks.
class DATABASE_CONFIG {
} you try this on database.php in config folder