1
votes

When I run Bake All I get this error.

Error: Database connection "Mysql" is missing, or could not be created.

I set up the app with Cake Bake and it works fine in the browser. There's another post on Stackoverflow with answers to this exact problem, but none of them worked for me.

How do I get CakePHP bake to find mysql.sock and recognize MySQL while using MAMP on Mac OSX?

I'm using Cake 2.0 with MAMP. Does anyone have any ideas? It's driving me crazy.

2
How do you access mysql via the command line? Are you able to access it with a command like this from any directory, or do you have to browse to a certain place? >> mysql -u username -p You should be able to do the former.Tom Rose
Yes, this works fine. I'm going to try out XAMPP later today and see if that works.Ian Hoar
Same issue in XAMPP. Totally stumped on this, I'm going to try setting it up on another computer.Ian Hoar

2 Answers

1
votes

Just change host from localhost to 127.0.0.1

public $default = array(
        'datasource' => 'Database/Mysql',
        'persistent' => false,
        'host' => '127.0.0.1',
        'login' => 'root',
        'password' => '1234',
        'database' => 'human',
        'prefix' => '',
        'encoding' => 'utf8',
    );
0
votes

This is a total hack. But, i've used it before...

Build another CakePHP install in a vanilla LAMP. I.e. run it on ubuntu linux or something. Bake your code in there, then copy the source files over.

I would encourage you to think of cake bake as a time saver rather than a mandatory step. The code it generates is very rudimentary. If you think of it that way, my ugly hack becomes more acceptable. :)