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


When you try to run Magento 2 and If you get this error message, possible reason is wrong username or password.

You can change this by editing, below information.

Go to app folder > Etc > and open env.php

In this file, you can find below code section

array (
'host' => 'localhost',
'dbname' => 'magento2',
'username' => 'root',
'password' => '',
'model' => 'mysql4',
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',

Replace your database information.


Senior Tech Lead at Netstarter PTY ltd. Magento Certified Front End Developer, Certified ScrumMaster, Microsoft Certified Professional, Member of British Computer Society

Leave a Reply

  • (will not be published)