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.
Share with your friends:
How To Generate A PDF from HTML in Laravel 11
Hello , I was trying to generate a PDF payment receipt for my SAAS application and when i search for […]
June 22, 2024
How to create Laravel Flash Messages
Laravel flash messages are a convenient way to display one-time notifications to the user after a form submission or other […]
December 22, 2022
How to make Custom Artisan Command in Laravel
Custom Artisan commands are a useful feature of Laravel that allow you to define your own command-line commands for tasks […]
December 22, 2022
Tips for Laravel migrations
Laravel migrations are a powerful tool for managing and modifying your database schema in a structured and organized way. Here […]
December 22, 2022
Digital Marketing Toolkit
Get Free Access to Digital Marketing Toolkit. You can use all our tools without any limits
Get Free Access Now