This error is very common when you try to log in to your MySQL for the first time.
Personally, I too faced this issue multiple times, maybe because we were not following the right way to install MySQL, or we forgot to set a password, or else we didn’t get the options to set a password.
Similarly, there may be many other reasons for the above error, but the solution to this error is pretty simple and easy. In this article, you will find a way to resolve 1698 (28000) Access denied for user ‘root’@’localhost’.
There are two ways to resolve this error. First, you will see a simple and less time-consuming method. If the first method didn’t work in your case, then go to the second one.