Reset Mysql Root password on Mac OSX

25 Aug 2011, by Michael Cindrić

Had a strange issue where mysql started asking for a password for my local mysql after updating my mysql2 gem. So to fix this had to update my root password and here is how l did it

  1. Stop MySQL service. You can do that using the preference pane if you have that installed or you can stop it using Terminal sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop

    1. Skipping Access Tables. If you have installed MySQL5, fire up Terminal window and execute /usr/local/mysql/bin/mysqld_safe --skip-grant-tables For older versions of MySQL, execute the following command /usr/local/mysql/bin/safe_mysqld --skip-grant-tables
    2. Reset MySQL root password. Now when safe_mysqld running in one Terminal window, open up another Terminal window and execute /usr/local/mysql/bin/mysql mysql. This opening up the MySQL console and opening the mysql table so we can update MySQL root user. Write the reset query into the console as follows UPDATE user SET Password=PASSWORD(‘YOUR_PASSWORD’) WHERE Host=’localhost’ AND User=’root’;. Replace “YOUR_PASSWORD” with your desired password.
  2. Once you’ve done that just exit the console “exit;” close the safe_mysqld execution and restart your MySQL server. You can do this using sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

Once you have done that you can access mysql again with no issues


Cookies help us deliver our services. By using our services, you agree to our use of cookies.