Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 stackoverflow.com 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.

add comment

2 Answers

up vote 2 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

/usr/local/mysql/bin/mysql_secure_installation

Hope this helps!

share|improve this answer
add comment

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
add comment