Here is my .env :
APP_ENV=local
APP_DEBUG=true
APP_KEY=G4snymV7W8EQ0vJTgVQ55R9eYB1qZyF0
DB_HOST=localhost
DB_DATABASE=todolists
DB_USERNAME=root
DB_PASSWORD=mysql
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
Hi i'm new in laravel. I know that this is fairly popular problem. I've beenn searching for the solution, but it seems that my case is litle bit different.
Because i can do the "php artisan migrate" and my database is changing, but when i try to see results in my browser then i gets that SQLSTATE
Here is my .env : APP_ENV=local APP_DEBUG=true APP_KEY=G4snymV7W8EQ0vJTgVQ55R9eYB1qZyF0
DB_HOST=localhost DB_DATABASE=todolists DB_USERNAME=root DB_PASSWORD=mysql
my database.php: 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', 'localhost'), 'database' => env('DB_DATABASE', 'todolists'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', 'mysql'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, ],
My routes.php: Route::resource('lists', 'ListsController');
My ListsController.php : public function index() { $lists = Todolist::all(); return view('lists.index')->with('lists', $lists); }
I'm searching the solution for week and I got stuck.
thank you in advance :)
Ok. Problem solved of course @Snapey had right i didn't understand. I had to read a litle, about what am i messing with. I messed up two different databases :).
First of all i didn't add the DB to homestead.yaml now is:
databases:
- homestead
- todolists
Next i created DB in homestead not in WAMP or Mysql server 5.7 And change .env file to:
DB_HOST=127.0.0.1:3306
DB_DATABASE=todolists
DB_USERNAME=homestead
DB_PASSWORD=secret
and database.php:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1:3306'),
'database' => env('DB_DATABASE', 'todolists'),
'username' => env('DB_USERNAME', 'homestead'),
'password' => env('DB_PASSWORD', 'secret'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
Thanks for your time guys :).
Please or to participate in this conversation.