Fixing a MariaDB database that has a corrupted root user password.
In one terminal window I did this:
echo $(brew --prefix MariaDB)
That gave me the path to my MariaDB of: /usr/local/opt/mariadb
Then I ran this in that same window:
/usr/local/opt/mariadb/mysqld_safe
That started MariaDB successfully.
Then I opened a 2nd terminal window.
sudo $(brew --prefix mariadb)/bin/mysqladmin -u root password
I followed the prompts to reset the password to ”, i.e. blank.
Then I killed the MariaDB current running by entering (in the same window I just reset the password in)
pkill mysqld
That stopped the Mariadb that was running.
Then back in the 1st window, i started Mariadb as I normally would:
mysql.server start
Then I was able to successfully log into root via
mysql -uroot
That was more painful that it seems.