【问题标题】:Cannot secure MariaDB installation on macOS Big Sur (Apple M1)无法在 macOS Big Sur (Apple M1) 上保护 MariaDB 安装
【发布时间】:2021-08-06 21:44:19
【问题描述】:

当我尝试使用 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

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

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

【问题讨论】:

    标签: mariadb homebrew macos-big-sur apple-m1


    【解决方案1】:

    你们为什么一直尝试sudo 和brew。 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。

    【讨论】:

    • 感谢您的帮助。抱歉,当我这样做时 sudo chown -R $USER:admin /opt/homebrew/* 我得到了错误:chown: /Users/myname/mynamedmin: illegal user name
    • @migswd 尝试将$USER 替换为$(whoami)。或手动输入您的用户名。 yourusername 中的 /Users/yourusername。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-21
    • 2021-07-19
    • 2021-06-08
    • 2021-03-01
    • 2021-09-04
    • 2021-11-26
    相关资源
    最近更新 更多