3
respostas

Erro lista produtos

Quanto tento lista os produtos . me retorna esse erro . Já verifiquei o arquivo .env , ja alterei o datadabase no aquivo database.php

PDOException in Connector.php line 47: SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) in Connector.php line 47 at PDO->__construct('mysql:host=localhost;dbname=homestead', 'homestead', 'secret', array('0', '2', '0', false, false)) in Connector.php line 47 at Connector->createConnection('mysql:host=localhost;dbname=homestead', array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'homestead', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, false)) in MySqlConnector.php line 20 at MySqlConnector->connect(array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'homestead', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in ConnectionFactory.php line 58 at ConnectionFactory->createSingleConnection(array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'homestead', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in ConnectionFactory.php line 47 at ConnectionFactory->make(array('driver' => 'mysql', 'host' => 'localhost', 'database' => 'homestead', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false), 'mysql') in DatabaseManager.php line 177

3 respostas

O usuário do seu banco de dados é realmente homestead? Geralmente o padrão é root quando está rodando localmente

Checa o usuario e senha no banco. Se estiver certo tenta usar esses dois comandos nessa ordem:

php artisan cache:clear
php artisan config:cache

Ola ! Eu encorei homestead dentro do config.php e substitui pelos parâmetros corretos e a conexão funcionou. Não sei por qual motivo meu laravel não usa as configuração do arquivo database.php. Obs: estou usando servidor local WampServer 3.0.4 64bit Apache 2.4.18 - PHP 5.6.19 - MySQL 5.7.11

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software