Reset MySQL 5 root password on Mac OS X

6,569

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.

Share:
6,569

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin over 1 year

    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.
  • Jan Jungnickel
    Jan Jungnickel over 14 years
    Don't kill -9 unless all else fails.
  • pix0r
    pix0r over 14 years
    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.