无法通过cake bake db_config创建数据库

时间:2015-07-17 14:11:52

标签: php mysql cakephp mamp

我正在database.php

创建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`

它会创建database.php文件,但是当我在浏览器中测试它时,我收到此消息

Cake is NOT able to connect to the database.
Database connection "Mysql" is missing, or could not be created.

仅当我通过phpMyAdmin手动创建数据库时,它才能正常工作。

我应该修复/做什么才能通过cake bake db_config

创建数据库

使用MAMPCakePHP 2.4.0

尝试创建database.php时没有出现任何错误,日志文件中也没有错误:

apache_error.log    
mysql_error_log.err 
php_error.log

1 个答案:

答案 0 :(得分:2)

Cake bake不会为您创建数据库,您需要在创建数据库配置文件之前手动创建它。