Alex Rivera | Logout

MacOSX homebrew mysql root password

Asked 2012-03-14T03:07:48.997
175

For some reason MySQL stopped giving access for root. Uninstalled and reinstalled with Homebrew. Fresh install, fresh tables but when I enter

mysql -u root -p

I get this error:

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

I reinstalled MySQL five times but it is still asking for a password. How do I fix this?

Edit
Report

1 Answer

164

Just run this command (where NEWPASS is your password):

$(brew --prefix mysql)/bin/mysqladmin -u root password NEWPASS

I have had the same error and fixed it this way.

answered 2012-09-06T01:07:43.553

Your Answer