1.安装mysql
brew search mysql
brew info mysql@5.7
brew install cmake openssl
brew install mysql@5.7
2.启动登陆mysql
# 设置环境变量 brew link mysql@5.7 --force alias mysqlstart='/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql.server start' alias mysqlstop='/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql.server stop' alias mysqlrestart='/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql.server restart' # 启动mysql brew services start mysql@5.7 brew services stop mysql@5.7 brew services restart mysql@5.7 or mysqlstart # 初始化mysql,设置密码等 mysql_secure_installation
3.免密码输入登陆mysql
#!/usr/bin/expect trap { set rows [stty rows] set cols [stty columns] stty rows $rows columns $cols < $spawn_out(slave,name) } WINCH spawn mysql -u root -p expect "*password:" # 填写设置的密码 send "******\r" expect "*#" interact
1.安装redis
brew search redis
brew info redis@3.2
brew install redis@3.2
2.启动redis
# 软链
brew link redis@3.2 --force
# 启动redis
brew services start redis@3.2
# 或者使用
redis-server /usr/local/etc/redis.conf
# 关闭redis服务
brew services stop redis@3.2
# 重启redis服务
brew services restart redis@3.2
# 测试redis是否启动
redis-cli ping
PONG #如果redis返回“PONG”,那么说明连接成功
3.开机启动/卸载redis
# 开机启动redis
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
# 停止开机启动redis
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
# 卸载redis
brew uninstall redis
rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist