MySQL ERROR 1045 (28000): Access denied for user ‘mentor’@’localhost’

The MySQL error 1045 can happen for many different reasons. It happened to us for a specific reason but in this post, we are going to discuss many possible reasons for this issue.

Case #1

One of the very basic cases is, if we try to connect to MySQL on the command line by exposing the password like below then it will throw the above error.

$ mysql -umentor -p<password> devdb

Not only MySQL will throw the error but also it will show a warning mentioning showing a password on the command line is not a good practice.