A blog probably of interest only to nerds by John Morton.

14Jan2020

Fix­ing a Mari­aDB data­base that has a cor­rupt­ed root user password.

In one ter­mi­nal win­dow I did this:

echo $(brew --prefix MariaDB)

That gave me the path to my Mari­aDB of: /usr/local/opt/mariadb

Then I ran this in that same window:

/usr/local/opt/mariadb/mysqld_safe

That start­ed Mari­aDB successfully.

Then I opened a 2nd ter­mi­nal window.

sudo $(brew --prefix mariadb)/bin/mysqladmin -u root password

I fol­lowed the prompts to reset the pass­word to ”, i.e. blank.

Then I killed the Mari­aDB cur­rent run­ning by enter­ing (in the same win­dow I just reset the pass­word in)

pkill mysqld

That stopped the Mari­adb that was running.

Then back in the 1st win­dow, i start­ed Mari­adb as I nor­mal­ly would:

mysql.server start

Then I was able to suc­cess­ful­ly log into root via

mysql -uroot

That was more painful that it seems.