By Administrator on May 6, 2021
Beginner

Install mariadb

Installing mariadb with homebrew is pretty simple. Just follow the below commands in your terminal and you should do fine!

# install mariadb
brew install mariadb

# optional. check for installation info.
brew info mariadb

Copy

Mariadb should be installed. Easy peasy!

Verify the installation using:

# check services list
brew services list

Copy

You should see mariadb running!

check for mariadb servicecheck for mariadb service!

To visually inspect, check it out in the MacOS Activity Monitor too!

Mariadb-process-running-check-in-activity-monitorMariadb-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 mariadb
brew services stop mariadb

# check again if maridb is running
brew services list

# if it still doesn't work .. try
# kill the process
pkill 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-TerminalMariadb-process-stopped-check-in-terminal

Mariadb-process-stopped-check-in-activity-monitorMariadb-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!!! CAREFUL
rm -rf /usr/local/var/mysql/

# recreate the initial files for mariadb
brew postinstall mariadb

# check for mariadb. also use Activity Monitor to be sure!
brew services list

brew services start mariadb
brew services list

brew services stop mariadb

sudo mysql_secure_installation
# the default password is blank

# login using the new password
mysql -uroot -p

Copy

Delete-old-mariadb-databases-and-recreate-a-fresh-configurationDelete-old-mariadb-databases-and-recreate-a-fresh-configuration

secure-mariadb-by-setting-a-root-password-and-limit-to-localhost.pngRun 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 PasswordVerify Mariadb Login By Using A Root Password

That’s it! Hope it was useful!



More articles on support



More articles on support
Comments

No comments yet.

Add a comment
Ctrl+Enter to add comment