Chonchol Mahmud Chonchol Mahmud - 1 year ago 319
HTML Question

Laravel PDOException error in Connector.php line 55

I am beginner in Laravel PHP framework.That's why i am trying basic task from HERE ( .I followed this basic task step by step.But after finishing this i am getting an error .I am putting the error here.

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

What is the meaning of this error?

SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)

Here is my .env file.


I have found similar problem in here. But there is no proper solution of it.

Here i add few lines (48 to 63) from Connector.php .

public function createConnection($dsn, array $config, array $options)
$username = Arr::get($config, 'username');

$password = Arr::get($config, 'password');

try {
$pdo = new PDO($dsn, $username, $password, $options);
} catch (Exception $e) {
$pdo = $this->tryAgainIfCausedByLostConnection(
$e, $dsn, $username, $password, $options

return $pdo;

Really i do get right solution of it.Have anyone who can give me the right solution of it? BTW this is laravel 5.2.

Thanks in advanced.

Rai Rai
Answer Source

SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)

This means, that your provided username and password is incorrect. If you're using homestead, default username ir homestead and the password is secret. Also, You might need to change the database port, since the default laravel configuration will look for port 3306, but homestead runs on port 33060

So the .env file should look like this: