Change your root password mac MySQL
Feb 28, 2024
- Open your terminal in any directory
- Assuming MySQL is installed
sudo mysql -u root ALTER USER 'root'@'localhost'
IDENTIFIED WITH mysql_native_password BY 'your_new_password';
or install using homebrew
Using Homebrew:
brew install mysql
brew tap homebrew/services
brew services start mysql
3. check the response list for my.cnf, file then add the below, save and close the file…
[mysqld]
# For debugging and recovery only #
skip-grant-tables
skip-networking
4. On the open terminal paste and enter the command MySQL -u root -p
Then the below
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_new_password';
5. Remove additions at number 3. from my.cnf, file.
6. Test changed root password using the command MySQL -u root -p
Hope you found this very useful, have a great day.