Laravel mySQL database error "Unknown database" -


im trying use command php artisan migrate, keep getting error:

pdoexception sqlstate[hy000] [1049] unknown database 'forge' 

at first got the:

access denied user 'homestead'@'localhost' 

but fixed when changed database.php , .env files to:

database.php

    'mysql' => [         'driver'    => 'mysql',         'host'      => env('db_host', 'localhost'),         'database'  => env('db_database', 'laravel'),         'username'  => env('db_username', 'root'),         'password'  => env('db_password', ''),         'charset'   => 'utf8',         'collation' => 'utf8_unicode_ci',         'prefix'    => '',         'strict'    => false,     ], 

.env

db_host=localhost db_database=laravel db_username=root db_password='' 

i read somewhere had create database in mysql database. if need why that, there alternative more effecient way command line. development environment windows 7.

update have solved error going localhost/phpmyadmin , creating database same name , collation. still dont understand why have use phpmyadmin create it, how able command line.

also, inside database have tables users, if more info users, create database or use table values ?

usually have of data contained in 1 database , have user have access table. method you're trying go through not secure have give laravel (or app) permission create tables, delete tables (to undo tables created), , read tables, can hairy in environment share database other applications.

it goes if application doesn't adhere prefix naming of dbs make them @ , collide application since namespacing doesn't exist.

if need functionality can follow guide written koster (http://laravel.io/forum/09-13-2014-create-new-database-and-tables-on-the-fly).


Comments