MacOS – Update password for root user of MySQL/MariaDB

For some reason, MySQL/MariaDB stopped giving access to the root user. Uninstalled and reinstalled with Homebrew. Fresh install, fresh tables but when you enter

mysql -u root -p

You get this error:

Access denied for user ‘root’@’localhost’ (using password: NO).

You reinstalled MySQL/MariaDB many times but it is still asking for a password.

Here is how you can fix this issue:

1/ Log in to MySQL/MariaDB by the root user.

sudo mysql -u root

2/ Execute the following command lines

ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘YOURNEWPASSWORD’;

 

Revisions

No comments yet.

Leave a Reply