无法在 macOS Big Sur (Apple M1) 上保护 MariaDB 安装

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

当我尝试使用 Homebrew(macOS Big Sur 11.4 和 MacBook Pro M1 芯片环境)保护我的 MariaDB 安装时遇到问题。

我使用该命令通过 Homebrew 安装了 MariaDB,没有出现任何错误:

brew install mariadb

然后在尝试执行推荐的安全过程时:

sudo /opt/homebrew/bin/mysql_secure_installation

我收到错误:

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

我在网上搜索了很多,但找不到任何解决方案。

有人遇到过并找到解决方案吗?

你们为什么一直尝试 sudobrew。 Homebrew 不支持 root 权限。不要在 brew.

之前添加 sudo
  1. 修复自制软件相关文件的所有权
# For x86 Mac
sudo chown -R $(whoami):admin /usr/local/*

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

对不起,我不想在这里再解释为什么brew不支持sudo。检查 this answer 是否有感兴趣的人。