How to fix Access denied for user Error in Laravel [fixed]
Do you know how to fix Access denied for user error in Laravel ? it’s actually a database connection issue. mainly in Cpanel I face this issue many times.
I found a solution for it. First, go to your root directory that contains the .env file open that up.
Your ENV File Database Config
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=emailsort DB_USERNAME=root DB_PASSWORD=password
There you can find the database details something like this.
Adding a single quote on Username and Password will fix the issue.
and the results should look like this.
Fixed ENV File Database Config
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=emailsort DB_USERNAME='root' DB_PASSWORD='password'
I just added a single ‘ ‘ quote for DB_USERNAME , DB_PASSWORD values. then it will work perfectly
Hope this helps you.