方法一:直接去mysql官网下载安装mysql客户端
1.mysql官网:MySQL :: Download MySQL Community Server

苹果芯片的mac下载arm版,intel芯片的mac下载x86版,然后一步一步安装好
2.Mac对Mysql环境进行配置
2.1.首先在我们的设备上找到终端并打开,输入 vim ~/.bash_profile(注意vim后面的空格),输入完成后点击回车键(Enther)

2.2点击回车键后会出现此画面,此时按下键盘上的“ i ”键进行编写,输入 export PATH=$PATH:/usr/local/mysql/bin

2.3.按下Esc键,输入 :wq (“ : ”也要输入),按下回车键进行保存


2.4.输入 source ~/.bash_profile 使此文本生效(注意source后面的空格),按下回车

5.此时输入 mysql --version 可以查看Mysql安装的版本,此时环境配置完成

方法二,通过 brew 安装 MySQL
1.安装mysql命令行输入:brew install mysql

2.启动 MySQL 服务器
命令行输入:brew services start mysql
MySQL 服务器管理命令
brew 提供了实用的命令可以管理 MySQL 服务器。
brew services start mysql: 启动 MySQL 服务器,并设置为自启动。
brew services stop mysql: 停止 MySQL 服务器,并设置为不自启动。
brew services run mysql: 只启动 MySQL 服务器。
mysql.server start: 启动 MySQL 服务器。
mysql.server stop: 停止 MySQL 服务器。
参考链接:https://blog.csdn.net/it_xushixiong/article/details/130567876
网友评论