Error in Laravel 5.0

Asked

Viewed 57 times

2

I have a connection problem in Laravel when running a query:

PDOException in Connector.php line 47:
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)

Database file.php:

'mysql' => [
    'driver'    => 'mysql',
    'host'      => env('DB_HOST', 'localhost'),
    'database'  => env('DB_DATABASE', 'estoque_laravel'),
    'username'  => env('DB_USERNAME', 'root'),
    'password'  => env('DB_PASSWORD', 'senhaacessodb'),
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix'    => '',
    'strict'    => false,
],

I configured the same, and keeps giving this error when accessing the page that executes the query.

2 answers

3


You also need to change the file . env

APP_ENV=local
APP_DEBUG=true
APP_KEY=zLzPMzs5W4FNNuguTmbG8M0iFqhIVnsP

DB_HOST=localhost
DB_DATABASE=estoque_laravel
DB_USERNAME=root
DB_PASSWORD=senhaacessodb

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

2

Not configured there. Settings are in the file .env, if it does not exist, rename the file .env.example for .env, inside the file will contain the variables:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

Edit with your current database settings.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.