[SOLVED] ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)

If you’ve just installed mysql community server (in my case on Fedora 23) and you’re getting:

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

The only thing that helped was:

edit your /etc/my.cnf file and add the line "skip-grant-tables" without quotes

After that you’ll be able to do:

 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:

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

You might want to:


mysql> SET PASSWORD=PASSWORD('your new password');
Query OK, 0 rows affected, 1 warning (0.00 sec)

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s