Answer the question
In order to leave comments, you need to log in
How to connect to database in homestead in laravel?
Created a new project in homestead laravel
In database.php I write the config
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '192.168.10.10'),
'database' => env('DB_DATABASE', 'myDBname'),
'username' => env('DB_USERNAME', 'homestead'),
'password' => env('DB_PASSWORD', 'secret'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'homestead.company' doesn't exist (SQL: select * from `company`)
Answer the question
In order to leave comments, you need to log in
Does the .env
file exist? Most likely in it settings of a DB are registered.
If not, then it's worth trying without env()
'host' => '192.168.10.10',
'database' => 'myDBname',
'username' => 'homestead',
'password' => 'secret',
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question