Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

This question already has an answer here:

For some reason when I installed MySQL on my machine (a Mac running OS X 10.9) the 'root' MySQL account got messed up and I don't have access to it, but I do have access to the standard MySQL account 'sean@localhost' which I use to log into phpMyAdmin.

I am trying to reset the 'root' password by starting the mysqld daemon using the command mysqld --skip-grant-tables and then running the following lines in the mysql> shell.

mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')

-> WHERE User='root';


Problem is when I try to run that MySQL string the daemon spits back a ERROR 1142 (42000): UPDATE command denied to user ''@'localhost' for table 'user' as if I didn't use the -u argument when I started the mysql shell, either though I did.

Any help is muchly appreciated as I am lost at this point. :/

share|improve this question

marked as duplicate by Dennis Kaarsemaker, cole, Rex, Ward, Falcon Momot Nov 13 '13 at 2:36

This question was marked as an exact duplicate of an existing question.

Well, you say you have access via:


But then you say you are denied access via:


So you are clearly have MySQL running with user grants. Which won’t help in a case like this. So the key should be too circumvent the user grants by stopping MySQL & re-launcing via (this is what I do on Ubuntu):

sudo mysqld --skip-grant-tables &

On a Mac it could be as simple as doing it without sudo:

mysqld --skip-grant-tables &

Then when that is running, login as root; you can do that now since the use grants are skipped:

mysql -u root mysql

Then run a query like this replacing with your own settings:

share|improve this answer
Upon running the last query I got the error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) back, it does say 'root' now, so I think we're getting somewhere. When I run mysql without parameters I get a ERROR 1046 (3D000): No database selected ERROR 1227 (42000): Access denied; you need (at least one of) the RELOAD privilege(s) for this operation back. Thoughts @JakeGould ? – Uncle Nerdicus Nov 10 '13 at 15:31
Don’t know. Perhaps the best & most realistic solution at this point is to just reinstall MySQL? – JakeGould Nov 10 '13 at 16:52
How do you reinstall it @JakeGould ? – Uncle Nerdicus Nov 10 '13 at 17:01
Do exactly what you did when you state, “…when I installed MySQL on my machine…” but now just do it again. – JakeGould Nov 10 '13 at 17:12
I got it working now using your advice and this , thank you for your patience kind sir. :-) – Uncle Nerdicus Nov 10 '13 at 18:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.