'ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) on Windows

when i want start mysql in windwos cmd i got this error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) what can i do?

mysql -u root -p

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


Solution 1:[1]

You can reset your root password. Have in mind that it is not advisable to use root without password.

Solution 2:[2]

install MYSQL again and define pass for root and define a user and after instalation MYSQL work on cmd whit

cd c:\Program Files\MySQL\MySQL Server 5.7\bin>

then

mysql -u myusername -p

then ask my pass and enter the password of this user name(not root password) and it work

other way for run MYSQL is start menu

in start menu find folder that named MySQL and expand it and run MySQL command line client

Solution 3:[3]

you can find your password by

#  cat /var/log/mysqld.log  | grep password

Solution 4:[4]

These errors sometimes due to DNS problem. To fix it, execute mysqladmin flush-hosts to reset the internal DNS host cache.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ashly Taylor
Solution 2 fariborz najafi
Solution 3 user8008930
Solution 4 AgileMethod