'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'db_larva',
'username' => 'root',
'password' => '*****',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'tbl_',
),
PDO扩展已启用,位于/opt/lampp/etc/php.ini
extension=php_pdo_mysql.dll
使用 create table 命令创建表。
php artisan migrate:make create_users --create=users
这里需要翻译的内容是:生成 2014_10_02_114459_create_users.php 文件。
php artisan migrate:make create_orders --create=orders
创建2014_10_02_054103_create_orders.php
现在在终端上我所做的是:
cd /opt/lampp/htdocs/larva/
php artisan migrate
出现错误信息:
[PDOException] 找不到驱动程序
当我运行时。
php artisan migrate --database=db_larva
出现了其他错误
[InvalidArgumentException]
数据库[db_larva]未配置。
请指导我错在哪里?
我的猜测:
Is location correct? do run
php artisan
inside the root folder?Default table structure inside
function up()
need to write some more code, may be db connection settings- difference between
php artisan migrate:make create_users --create=users
andphp artisan migrate:make create_users --create --table=users
- I have to configure database settings somewhere else too.
- table prefix can be problematic.
I haven't write single line to connect database, anywhere in the code yet. where to write the connection sting in code, or that is a later stage?
php --ini
gives different path of php ini?Configuration File (php.ini) Path: /etc/php5/cli Loaded Configuration File: /etc/php5/cli/php.ini Scan for additional .ini files in: /etc/php5/cli/conf.d Additional .ini files parsed: /etc/php5/cli/conf.d/05-opcache.ini, /etc/php5/cli/conf.d/10-pdo.ini, /etc/php5/cli/conf.d/20-json.ini, /etc/php5/cli/conf.d/20-mcrypt.ini, /etc/php5/cli/conf.d/20-readline.ini, /etc/php5/cli/conf.d/20-xdebug.ini