MariaDB on Mac
By Administrator on May 6, 2021
BeginnerInstall mariadb
Installing mariadb
with homebrew
is pretty simple. Just follow the below commands in your terminal and you should do fine!
# install mariadbbrew install mariadb# optional. check for installation info.brew info mariadb
Copy
Mariadb should be installed. Easy peasy!
Verify the installation using:
# check services listbrew services list
Copy
You should see mariadb
running!
check for mariadb service!
To visually inspect, check it out in the MacOS Activity Monitor too!
Mariadb-process-running-check-in-activity-monitor
Secure mariadb root password
This is where things got (very) painful! Securing mariadb threw up a lot of results in Stack Overflow and after many hours of trials. The following worked for us!
# stop mariadbbrew services stop mariadb# check again if maridb is runningbrew services list# if it still doesn't work .. try# kill the processpkill mariadbd# check in activity monitor to be 100% sure
Copy
To be absolutely sure, terminal and activity monitor should show that mariadb
has stopped!
Mariadb-process-stopped-check-in-terminal
Mariadb-process-stopped-check-in-activity-monitor
Now, to securing mariadb by setting the root
password, this turned out to be more complicated than expect. The following worked for us!
Note! We will delete the existing database. Which was OK for us!
# NOTE: this will delete your existing database!!! CAREFULrm -rf /usr/local/var/mysql/# recreate the initial files for mariadbbrew postinstall mariadb# check for mariadb. also use Activity Monitor to be sure!brew services listbrew services start mariadbbrew services listbrew services stop mariadbsudo mysql_secure_installation# the default password is blank# login using the new passwordmysql -uroot -p
Copy
Delete-old-mariadb-databases-and-recreate-a-fresh-configuration
Run mysql_secure_installation to secure mariadb by setting a root password and limit to localhost
Note: we didn’t use unix_socket_authentication
Verify Mariadb Login By Using A Root Password
That’s it! Hope it was useful!
More articles on support