I'm creating database.php
file by cake bake db_config
Database Configuration:
---------------------------------------------------------------
Name:
[default] >
Datasource: (Mysql/Postgres/Sqlite/Sqlserver)
[Mysql] >
Persistent Connection? (y/n)
[n] >
Database Host:
[localhost] >
Port?
[n] >
User:
[root] >
Password:
>
Database Name:
[cake] > testdb
Table Prefix?
[n] >
Table encoding?
[n] >
---------------------------------------------------------------
The following database configuration will be created:
---------------------------------------------------------------
Name: default
Datasource: Mysql
Persistent: false
Host: localhost
User: root
Pass: ****
Database: testdb
---------------------------------------------------------------
Look okay? (y/n)
[y] > y
Do you wish to add another database configuration?
[n] >
Wrote `/Applications/MAMP/htdocs/linda/app/Config/database.php`
It does create the database.php
file, but when I test it in a browser, I'm getting this message
Cake is NOT able to connect to the database.
Database connection "Mysql" is missing, or could not be created.
Only, when I create database manually by phpMyAdmin
it starts working fine.
What should I fix/do to be able to create database by cake bake db_config
Using MAMP
and CakePHP 2.4.0
Doesn't get any errors when trying to create database.php
, also have no errors in log files:
apache_error.log
mysql_error_log.err
php_error.log
Cake bake doesn't create the database for you, you need to create it manually before you create the database configuration file.