If you’ve just installed mysql community server (in my case on Fedora 23) and you’re getting:
1 |
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) |
The only thing that helped was:
1 2 |
<span class="comment-copy">edit your /etc/my.cnf file and add the line "skip-grant-tables" without quotes </span> |
After that you’ll be able to do:
1 |
mysql -uroot -p |
and type the new password. Then:
mysql> use mysql; mysql> UPDATE user SET password=PASSWORD("YOUR NEW PASSWORD HERE") WHERE User='root'; mysql> flush privileges; mysql> quit
By the way, if you login back into mysql and then try:
1 2 3 |
mysql> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. |
You might want to:
1 2 3 |
mysql> SET PASSWORD=PASSWORD('your new password'); Query OK, 0 rows affected, 1 warning (0.00 sec) |