If you’re getting error 1045 that reads something like “Access denied for user ‘root’@’localhost’“, it’s because you’re trying to log in to MySQL without the right credentials.
This usually happens when we provide the wrong password. But there could also be another cause. For example, we could be trying to do something as the root user that requires a password, but the root user hasn’t yet had its password set.
To fix this issue, be sure to provide the correct password when connecting to MySQL.