侧边栏壁纸
博主头像
Ysfun博主等级

一名热爱技术、喜欢折腾的小小程序猿

  • 累计撰写 42 篇文章
  • 累计创建 14 个标签
  • 累计收到 25 条评论

目 录CONTENT

文章目录

mac上使用Homebrew安装mysql

Ysfun
2022-06-17 / 0 评论 / 0 点赞 / 84 阅读 / 333 字

注意⚠️:本教程是采用Homebrew安装mysql,引用官方的一句话:Homebrew是Mac OS 不可或缺的套件管理器。执行一下命令即可安装Homebrew:

# 安装Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
# 查看版本信息
% brew -v
# 出现下面版本信息,则表明安装成功
Homebrew 3.3.4
Homebrew/homebrew-core (git revision 4605f7a940f; last commit 2021-11-21)

安装mysql

  1. 使用Homebrew搜索mysql版本
% brew search mysql

==> Formulae
automysqlbackup          mysql-client             mysql-sandbox            mysql@5.7
mysql                    mysql-client@5.7         mysql-search-replace     mysqltuner
mysql++                  mysql-connector-c++      mysql@5.6                qt-mysql

==> Casks
homebrew/cask/mysql-connector-python               homebrew/cask/navicat-for-mysql
homebrew/cask/mysql-shell                          homebrew/cask/sqlpro-for-mysql
homebrew/cask/mysql-utilities
  1. 安装mysql@5.7
% brew install mysql@5.7

==> Downloading https://ghcr.io/v2/homebrew/core/mysql/5.7/manifests/5.7.36
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/mysql/5.7/blobs/sha256:e23df0f6e8bfc83fe2e982ec60e8
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:e23df0f6e8bfc83
######################################################################## 100.0%
==> Pouring mysql@5.7--5.7.36.arm64_big_sur.bottle.tar.gz
==> /opt/homebrew/Cellar/mysql@5.7/5.7.36/bin/mysqld --initialize-insecure --user=hyunmin --basedir=
==> Caveats
...
  1. 配置环境变量
# 1. bash shell
% vim ~/.bash_profile
# 2. zsh shell
% vim ~/.zshrc

# 在配置文件中加入
export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"

% source ~/.bash_profile
# 或
% source ~/.zshrc

  1. 启动MySQL服务
% mysql.server start

Starting MySQL
. SUCCESS! 
  1. MySQL初始化配置
% mysql_secure_installation

  1. 登陆测试

0

评论区