通过 Homebrew 安装 MySQL 和配置

安装

  1. 安装 MySQL: brew install mysql
  2. 启动 MySQL: mysql.server start
  3. 检查 MySQL 服务状态: systemctl status mysql.service
  4. 安全设置: myqsl_secure_installation, 执行后提示安全策略:

    There are three levels of password validation policy:
    
    LOW    Length >= 8
    MEDIUM Length >= 8, numeric, mixed case, and special characters
    STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

    根据提示选择密码等级, 设置 Root 密码

创建用户

  1. 创建用户: create user 'herbert_u'@'%' identified by 'herbert_123';
  2. 授权用户:

    grant all privileges on retail_db.* to 'herbert_u'@'%';
    flush privileges;

你可能感兴趣的:(mysql,homebrew)