DEV Community

Felicia oke
Felicia oke

Posted on

How to reset MySQL 8 password on Mac

Mysql is a powerful database management system that is open-source and free. To prevent unauthorized access, it offers administrative access to the database system. You may also select which database operations a user is permitted to do.
In this post, we'll walk you through two basic steps for resetting your MySQL passwordon aMac`.

Prerequisites

To complete this tutorial, you must have the following are required:

  • Having access to a server running MySQL e.g apache
  • You must have a MySQL database already ## Resetting MySQL password

In this post, we'll walk you through two basic steps for resetting your MySQL password on a Mac.

  1. Stopping a MySQL server

If mysql is being utilized, it must first be stopped from running. To do so, open your terminal and type the following command:

sudo /usr/local/mysql/support-files/mysql.server stop
Enter fullscreen mode Exit fullscreen mode

This will bring the server to a stop, allowing us to proceed with the password reset.

  1. Running safe mode

We need to run the MySQL server in safe mode with privilege bypass. To accomplish this, use the following command in the terminal:

sudo mysqld_safe --skip-grant-tables
Enter fullscreen mode Exit fullscreen mode
  1. Setting the password

Now that we've bypassed MySQL server privilege, we need to reset the user password to null. To do so, start a new terminal and type the commands below:

mysql -u root
UPDATE mysql.user SET authentication_string=null WHERE User='root';
Enter fullscreen mode Exit fullscreen mode

We can now modify the user password because it has been changed to null. To accomplish this, enter the following commands:

mysql -u root
UPDATE mysql.user SET authentication_string=PASSWORD("newpassword") WHERE User='root';
FLUSH PRIVILEGES;
Enter fullscreen mode Exit fullscreen mode

Change the **newpassword** in the above command to your desired password.

recap

The overall command to change the password is as follows:

sudo /usr/local/mysql/support-files/mysql.server stop
sudo mysqld_safe --skip-grant-tables
mysql -u root
UPDATE mysql.user SET authentication_string=null WHERE User='root';
mysql -u root
UPDATE mysql.user SET authentication_string=PASSWORD("newpassword") WHERE User='root';
FLUSH PRIVILEGES;
Enter fullscreen mode Exit fullscreen mode




Connecting the new MySQL password to Arctype

You can now connect the new password to your Arctype account after successfully resetting the MySQL user password.
The step-by-step instructions below will show you how to connect with Arctype:
'Step 1': go to arctype.com and download Arctype Workplace for Windows.
'Step2': after installing Arctype, run it and the MySQL server as well. This will take you to a welcome page where you can log in to your account, then to the 'connection page' where you will select MySQL.

‘Step3;’ After selecting MySQL, we open a page where you can fill in the details. In the 'password field,' don't forget to use mysql's new password. When you click save the connection,' you'll be sent to your Arctype workspace dashboard.

Conclusion

We learned how to change MySQL 8 user password on Mac, as well as how to connect mysql with Arctype workspace in this article.

Top comments (0)