migmaker
migmaker

Reputation: 2516

Cannot secure MariaDB installation on macOS Big Sur (Apple M1)

I got a problem when I try to secure my MariaDB installation with Homebrew (macOS Big Sur 11.4 and MacBook Pro M1 chip environment).

I installed MariaDB through Homebrew with that command and got no errors:

brew install mariadb

Then when trying to do the recommended secure process:

sudo /opt/homebrew/bin/mysql_secure_installation

I got the error :

touch: .my.cnf.25188: Read-only file system
touch: .mysql.25188: Read-only file system
chmod: .my.cnf.25188: No such file or directory
chmod: .mysql.25188: No such file or directory

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
/opt/homebrew/bin/mysql_secure_installation: line 249: .my.cnf.25188: Read-only file system
/opt/homebrew/bin/mysql_secure_installation: line 250: .my.cnf.25188: Read-only file system
/opt/homebrew/bin/mysql_secure_installation: line 251: .my.cnf.25188: Read-only file system
/opt/homebrew/bin/mysql_secure_installation: line 253: .my.cnf.25188: Read-only file system
/opt/homebrew/bin/mysql_secure_installation: line 218: .mysql.25188: Read-only file system
/opt/homebrew/bin/mysql_secure_installation: line 220: .mysql.25188: No such file or directory

I searched a lot through the web but cannot find any solution.

Somebody had encounter and find a solution for that ?

Upvotes: 0

Views: 1369

Answers (1)

Simba
Simba

Reputation: 27608

Why did you guys keeping trying sudo with brew. Homebrew doesn't support root privilege. Don't prepend sudo before brew.

  1. Fix ownership of homebrew related files
# For x86 Mac
sudo chown -R $(whoami):admin /usr/local/*

# For M1 Mac
sudo chown -R $(whoami):admin /opt/homebrew/*
  1. Run /opt/homebrew/opt/mariadb/bin/mysql_secure_installation

Sorry, I don't wanna explain again why brew doesn't support sudo here. Check this answer for anyone who is interested.

Upvotes: 2

Related Questions