0
votes

Hi I'm having a problem with laravel 5.3 project was moved from one host to another and I've updated the .env file

The project was working well in the old host but when I moved to the new host, the site displaying this error

1/2

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

2/2

QueryException in Connection.php line 770: SQLSTATE[HY000] [1045] Access denied for user 'xxxx'@'localhost' (using password: YES) (SQL: select * from countries)

xxxx => The user name for the old database was not updated. i do not know the reasonenter image description here

3
does your database has the correct user?Wouter Van Damme
Looks like a similar issue as this stackoverflow.com/questions/20353402/…Edwin Krause
Just a hunch but try using 127.0.0.1 instead of localhost in your .env file. Also try connecting directly via CLI to remove as many factors as possible like old config files.user1669496

3 Answers

0
votes

There are many possible reasons to throw this exception, let's explore them:

  1. There is a kind of cache in the .env file. In this case, you could only rewrite the DB variables, run php artisan config:clear and restart the server.
  2. Maybe some of the DB variables aren't right. In this case, you could check out the values.
  3. The user is right but he hasn't permission to access the database. In this case, you could check out the user permissions.

I hope that one of these tips help you.

0
votes
  1. Check the .env file it should include all value like CONNECTION, HOST, PORT, etc.
  2. php artisan config:clear
  3. composer dump-autoload and restart the server
0
votes

the SQLSQLSTATE[HY000] [1045] seems like the password in your .env file doesn't match with the database's password.

You can check the database pass and user in the new server and put into your .env file.

Good luck