通过 Homebrew 安装 MySQL 和配置
文章目录
安装
安装 MySQL:
brew install mysql
启动 MySQL:
mysql.server start
检查 MySQL 服务状态:
systemctl status mysql.service
安全设置:
mysql_secure_installation
, 执行后提示安全策略:1 2 3 4 5
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 密码
创建用户
创建用户:
create user 'herbert_u'@'%' identified by 'herbert_123';
授权用户:
1 2
grant all privileges on retail_db.* to 'herbert_u'@'%'; flush privileges;