实战 Mac

实战 Mac

Brew 安装

安装 Homebrew

https://brew.sh/

1
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

配置国内镜像

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 替换brew.git:
cd "$(brew --repo)"
# 中国科大:
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 清华大学:
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

# 替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
# 中国科大:
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 清华大学:
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

# 替换homebrew-bottles:
# 中国科大:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 清华大学:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

# 应用生效:
brew update

确定 brew 健康状况

1
2
3
4
# 确认brew在正常工作
brew doctor
# update更新包
brew

Mysql

安装

1
2
## 安装mysql
brew install mysql

开启服务

1
brew services start mysql

设置用户名密码

设置简单密码规则

1
2
3
4
5
6
7
8
mysql -uroot

# 允许简单密码
set global validate_password.policy=0;
set global validate_password.length=1;

# 修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'example';

验证

1
mysql -uroot -pexample