无法通过烘焙蛋糕创建数据库 db_config
Unable to create database by cake bake db_config
我正在通过 cake bake db_config
创建 database.php
文件
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
手动创建数据库时,它开始正常工作。
我 fix/do 应该怎么做才能通过 cake bake db_config
创建数据库
使用 MAMP
和 CakePHP 2.4.0
尝试创建时没有出现任何错误 database.php
,日志文件中也没有错误:
apache_error.log
mysql_error_log.err
php_error.log
Cake bake 不会为您创建数据库,您需要在创建数据库配置文件之前手动创建它。
我正在通过 cake bake db_config
database.php
文件
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
手动创建数据库时,它开始正常工作。
我 fix/do 应该怎么做才能通过 cake bake db_config
使用 MAMP
和 CakePHP 2.4.0
尝试创建时没有出现任何错误 database.php
,日志文件中也没有错误:
apache_error.log
mysql_error_log.err
php_error.log
Cake bake 不会为您创建数据库,您需要在创建数据库配置文件之前手动创建它。