經過 Homebrew 安裝 MySQL 和配置

安裝

  1. 安裝 MySQL: brew install mysql
  2. 啓動 MySQL: mysql.server start
  3. 檢查 MySQL 服務狀態: systemctl status mysql.service
  4. 安全設置: myqsl_secure_installation, 執行後提示安全策略:mysql

    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 密碼sql

建立用戶

  1. 建立用戶: create user 'herbert_u'@'%' identified by 'herbert_123';
  2. 受權用戶:shell

    grant all privileges on retail_db.* to 'herbert_u'@'%';
    flush privileges;
相關文章
相關標籤/搜索