mysqlmariadbremote-accessremote-server

ERROR 1045 (28000): Access denied for user 'root'@'localhost'


After installing MySQL for the first time, the command line client is not opening so i searched for solutions.

They said i must go to the bin directory and run it manually. and after I run below command and enter password.

mysql -u root -p

But it gives this error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost'

I tried some solution on stack overflow including disabling permissions, running manually which i mentioned above, starting the service from service.msc, running it with password and without it just doesn't want to work.

appreciate any help in advance.


Solution

  • I got the answer myself. Seemingly, if you get this error, it means that you need to reset your password. You can learn how to do that in MySQL from this link.

    And don't forget to change the 5.7 version with your currently installed version in using commands (mine was 8.0). After that, everything was working fine for me.