macOS Catalina Homebrew mariadb Installation Issues

I have a solution that worked for me. I was trying to install the latest version of mariadb (10.5.6) First stop any mysql service that you might have running

brew services stop mariadb

Next you need to delete the contents of /usr/local/var/mysql sudo rm -rf /usr/local/var/mysql

You then need to create the database installation files

mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mariadb)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

This will get the mariadb Cellar location as installed by brew and do the db file installation. Next step is to start up mariadb brew services start mariadb

We now need to set up a password. Don't bother with mysql_secure_connection or mariadb-secure-connection. I had issues with them

Log into mysql sudo mariadb -u root

We now need to change the user root's password

> use mysql;

> ALTER USER 'root'@'localhost' IDENTIFIED BY 'mypassword';

> flush privileges;

> quit

You can now try logging into mariadb mariadb -u root -p