I just installed MySQL 5 on Mac OS X Snow Leopard (10.6.1), set a password and forgot it. I tried to follow this tutorial: http://blog.innovativethought.net/2007/05/17/resetting-your-forgotten-mysql-password/ but when I do:

/usr/local/mysql/bin/mysqld_safe --ignore-grant-table

it says:

touch:
/usr/local/mysql/data/unknown-00-24-8d-0d-d4-cf.lan.err:
Permission denied chown:
/usr/local/mysql/data/unknown-00-24-8d-0d-d4-cf.lan.err:
Permission denied Starting mysqld
daemon with databases from
/usr/local/mysql/data
/usr/local/mysql/bin/mysqld_safe: line
380:
/usr/local/mysql/data/unknown-00-24-8d-0d-d4-cf.lan.err:
Permission denied rm:
/usr/local/mysql/data/unknown-00-24-8d-0d-d4-cf.lan.pid:
Permission denied
/usr/local/mysql/bin/mysqld_safe: line
388:
/usr/local/mysql/data/unknown-00-24-8d-0d-d4-cf.lan.err:
Permission denied STOPPING server from
pid file
/usr/local/mysql/data/unknown-00-24-8d-0d-d4-cf.lan.pid
tee:
/usr/local/mysql/data/unknown-00-24-8d-0d-d4-cf.lan.err:
Permission denied 090920 16:14:34
mysqld ended tee:
/usr/local/mysql/data/unknown-00-24-8d-0d-d4-cf.lan.err:
Permission denied

and when I do (using sudo):

sudo /usr/local/mysql/bin/mysqld_safe --ignore-grant-table

it says:

Starting mysqld daemon with databases from /usr/local/mysql/data
STOPPING server from pid file /usr/local/mysql/data/unknown-00-24-8d-0d-d4-cf.lan.pid
090920 16:15:36 mysqld ended

Why the heck does it stop? Can someone explain it?

Thanks in advance.

Oh,

  • I'm NOT using Mac OS X Server.
  • I've set the password in phpMyAdmin.
link|improve this question

71% accept rate
feedback

2 Answers

Stop the server before restarting it in safemode.

sudo kill -9 $(cat /usr/local/mysql/data/unknown-00-24-8d-0d-d4-cf.lan.pid)

Then follow (as root, or with sudo) the instructions.

link|improve this answer
2  
Don't kill -9 unless all else fails. – Jan Jungnickel Sep 20 '09 at 19:19
I agree, it was the short way :P – AlberT Sep 21 '09 at 7:21
1  
This won't work - launchd will start a new process as soon as it's killed. You need to use launchctl to stop the process and then start your own. – pix0r Nov 9 '09 at 21:51
feedback

I just encountered the same problem and solved it. With MySQL 5, do

sudo /usr/local/mysql/bin/mysqld_safe5 --skip-grant-tables
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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