我正在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
使用MAMP
和CakePHP 2.4.0
尝试创建database.php
时没有出现任何错误,日志文件中也没有错误:
apache_error.log
mysql_error_log.err
php_error.log
答案 0 :(得分:2)
Cake bake不会为您创建数据库,您需要在创建数据库配置文件之前手动创建它。