Are you getting from Cake bake "Database connection Mysql is missing, or could not be created" on your Mac using Mamp?

I will tell you why. It`s because apparently Mac already comes with a PHP command line interpreter. So the PHP you are calling are not the same from Mamp.


Take a look below where I`m on the root folder from my Cake PHP application.
system2:regroup ritter$ ./lib/Cake/Console/cake bake

Welcome to CakePHP v2.4.4 Console
---------------------------------------------------------------
App : app
Path: /Users/ritter/Documents/sites/regroup/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)
> m
---------------------------------------------------------------
Bake Model
Path: /Users/ritter/Documents/sites/regroup/app/Model/
---------------------------------------------------------------
Error: Database connection "Mysql" is missing, or could not be created.
#0 /Users/ritter/Documents/sites/regroup/lib/Cake/Model/Datasource/DboSource.php(260): Mysql->connect()
#1 /Users/ritter/Documents/sites/regroup/lib/Cake/Model/ConnectionManager.php(105): DboSource->__construct(Array)
#2 /Users/ritter/Documents/sites/regroup/lib/Cake/Console/Command/Task/ModelTask.php(927): ConnectionManager::getDataSource('default')
#3 /Users/ritter/Documents/sites/regroup/lib/Cake/Console/Command/Task/ModelTask.php(864): ModelTask->getAllTables(NULL)
#4 /Users/ritter/Documents/sites/regroup/lib/Cake/Console/Command/Task/ModelTask.php(954): ModelTask->listAll(NULL)
#5 /Users/ritter/Documents/sites/regroup/lib/Cake/Console/Command/Task/ModelTask.php(203): ModelTask->getName()
#6 /Users/ritter/Documents/sites/regroup/lib/Cake/Console/Command/Task/ModelTask.php(91): ModelTask->_interactive()
#7 /Users/ritter/Documents/sites/regroup/lib/Cake/Console/Command/BakeShell.php(109): ModelTask->execute()
#8 /Users/ritter/Documents/sites/regroup/lib/Cake/Console/Shell.php(434): BakeShell->main()
#9 /Users/ritter/Documents/sites/regroup/lib/Cake/Console/ShellDispatcher.php(207): Shell->runCommand(NULL, Array)
#10 /Users/ritter/Documents/sites/regroup/lib/Cake/Console/ShellDispatcher.php(66): ShellDispatcher->dispatch()
#11 /Users/ritter/Documents/sites/regroup/lib/Cake/Console/cake.php(49): ShellDispatcher::run(Array)
#12 {main}



How to deal with it? Simple: Call the PHP you want, directly, and everything will go smoothly. Have fun codding!


system2:regroup ritter$ /Applications/MAMP/bin/php/php5.4.10/bin/php ./lib/Cake/Console/cake.php bake





2014-03-23 23:42:00
Computers and science as a way to live

As you may know, I`m a programmer, I work most in web projects, but not only. This area is a mess! Each day you have to recycle what you know in many ways. The thing is, a knowledge that change so often can`t afford wait to be translated to Portuguese for instance, at that time, the known will be already deprecated. English to me is a functional requirement. I can`t imagine my daily life without it. I have been studding English for serious since 2009. In this section you can see what I`m working on. Have fun as I do.
RSS Feed
"A vida é curta demais para ser pequena / The live is so short to be small / Das leben zu kurz sind für kleine sein". (Benjamin Disraeli)