uninstall if necessary
brew services stop mariadb
brew uninstall mariadb
rm -rf /usr/local/var/mysql /usr/local/etc/my.cnf # be sure to backup first
(re)install
brew install mariadb
brew services start mariadb
sudo mysql_secure_installation
sudo mysql -uroot
list default users
select Host, User, Password from mysql.user;
output is something like this:
+-----------+-------------+----------+
| Host | User | Password |
+-----------+-------------+----------+
| localhost | mariadb.sys | |
| localhost | root | |
| ... | ... | ... |
+-----------+-------------+----------+
create new user that can login via other host (%
is wildcard), like 127.0.0.1
create user 'admin'@'%' identified by '';
grant all privileges on *.* to 'admin'@'%' identified by '' with grant option;
result:
+-----------+-------------+----------+
| Host | User | Password |
+-----------+-------------+----------+
| localhost | mariadb.sys | |
| localhost | root | |
| ... | ... | ... |
| % | admin | | 👈
+-----------+-------------+----------+