You Here!
  • Home
  • DatabasesMySQLReset Your Forgotten MySQL Root Password on Mac in 4 Easy Steps!
Ahmad Gohar Featured Image 1886_826

Reset Your Forgotten MySQL Root Password on Mac in 4 Easy Steps!

Have you forgotten your Mac OS X MySQL root password and need to reset it? Don’t worry—it happens to everyone. Follow these four simple steps to regain access quickly and efficiently.


Step 1: Stop the MySQL Server

To begin, stop the running MySQL server. Here’s how:

  1. Navigate to System Preferences on your Mac.
  2. Select MySQL from the menu.
  3. Click Stop MySQL Server.

This ensures the database is offline for the reset process.


Step 2: Start MySQL in Safe Mode

Next, you’ll need to bypass privileges by starting MySQL in safe mode. Open your Terminal and run the following command:

sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

This temporarily disables authentication checks.


Step 3: Update the Root Password

In a new Terminal window, log into MySQL as the root user:

sudo /usr/local/mysql/bin/mysql -u root

Depending on your MySQL version, use one of these commands:

For MySQL versions older than 5.7:

UPDATE mysql.user SET Password=PASSWORD('your-password') WHERE User='root';

For MySQL 5.7 and newer:

USE mysql;  
UPDATE mysql.user SET authentication_string=PASSWORD('your-password') WHERE User='root';  

Finally, refresh the privileges and exit:

FLUSH PRIVILEGES;
EXIT;

Step 4: Restart MySQL in Normal Mode

Once the password is updated, stop the safe mode server and restart MySQL in normal mode. This can be done through System Preferences or the Terminal:

sudo /usr/local/mysql/bin/mysqladmin shutdown
sudo /usr/local/mysql/support-files/mysql.server start

With these steps, your MySQL root password is reset and your database is secure. Always remember to store your new credentials safely!


Additional Tips:

  • If the steps don’t work, ensure you run the commands with proper administrative privileges.
  • For persistent issues, consider reinstalling MySQL or consulting the official documentation.

Would you like me to help with additional SEO improvements or related content ideas? 😊

author avatar
Ahmad Gohar
With over 18 years of experience in software architecture, Java technologies, and leadership, I specialize in crafting scalable, future-proof solutions for global organizations. Whether it’s transforming legacy systems, building cutting-edge cloud-native applications, or mentoring teams to excel, I’m committed to delivering value-driven results.

Leave A Comment