Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
reseting mysql root password

I am having an issue on OS X 10.7.5 as I used to use MAMP but for .htaccess issues I am now using my own compiled local server from a long time ago, the problem is i forgot the root password for mysql.

I have tried updating the password through terminal using mysql -u root, but I get this error message -> ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

share|improve this question

migrated from Nov 20 '12 at 15:06

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Ward, Michael Hampton, mdpc, HopelessN00b, sysadmin1138 Nov 20 '12 at 20:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 3 down vote accepted

Try to find mysql_secure_install and run it. This script will allow you to reset root password among all other things.

Possible paths is


Hope this helps!

share|improve this answer
If this script has already been run once, then it will prompt you for the current password with the OP doesn't know. – txyoji Sep 16 '15 at 14:10

mysql -u root attempts to login as the root user with no password (which won't work if a password is set, as one would hope). To login, you either need to specify the -p flag and provide the current password; or else see Resetting the Root Password: Unix Systems.

share|improve this answer
Ok, to fix the issue I just did a clean install of mysql as I had no databases that I needed. – Rik89 Nov 20 '12 at 12:00