sqlstate(hy000 error 1045) access denied for user laravel

sqlstate(hy000 error 1045) access denied for user laravel

The error SQLSTATE [HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: YES) or (using password: Now) comes in two conditions, The first is that you have not configured the database correctly with Laravel, or else your application is cached.

There are two ways to fix the error, firstly clear the cache of the application and secondly configure the database in the application correctly.

Here are two solutions to fix sqlstate(hy000) (1045) access denied for user ‘root’@’localhost’ (using password: yes or no) in laravel:

Solution 1 – SQLSTATE[HY000] [1045] Access denied for ‘root’@’localhost’ (using password: YES)

To fix the error SQLSTATE[HY000] [1045] Access denied for user ”@’localhost’ (using password: Yes), Navigate to laravel app root directory and open your .env file and add the correct database details; as follows:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=

For this, you have to open the .env file in the Laravel app and add the database name, username and password.

Solution 2 – SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: No)

The error “sqlstate(hy000) (1045) Access denied for user ‘root’@’localhost’ (using password: no)” can occur in Laravel, when your Laravel application gets cached. Simply open your cmd or terminal and clear all the cache from laravel app by running php artisan config:clear command into it.

php artisan config:clear

Conclusion

In this tutorial, you have found two solutions for SQLSTATE[HY000] [1045] Access denied for user ‘abua’@’localhost’ (using password: YES and No) laravel.

Recommended Laravel Tutorials

AuthorAdmin

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *