Mac OS X 10.15.5 安装MySql 5.7
2020-06-06 本文已影响0人
码上版码
Mac OS X 10.15.1 安装MySql 5.7
一:下载MySQL安装包
官网下载:https://dev.mysql.com/downloads/mysql/
进入后选择以前版本,5.7.28

二:安装MySQL
打开dmg安装包文件,等待检查完毕,跳出下图窗口
双击mysql-5.7.28-macos10.14-x86_64.pkg
就会出现熟悉的安装流程

一步步操作到最后,安装就完成了。

弹窗显示默认密码
2020-06-05T09:25:58.129858Z 1 [Note] A temporary password is generated for root@localhost: d5LPxW&diBa9---默认密码
If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.
三:启动MySQL服务
打开【系统偏好设置】,可以看到多了一个MySQL 服务图标

点击进入MySQL服务后,点击Start MySQL Server,输入用户密码即可

四:配置MySQL环境变量
打开终端输入:
vim ~/.bash_profile,按i进入编辑模式,插入
export PATH=PATH:/usr/local/mysql-5.7.31/support-files
按esc,英文模式::wq ,保存退出vim编辑模式
再输入:source ~/.bash_profile更新
【注释:.zprofile 的作用与 .bash_profile 相同,所以macOS10.15配置文件是.zprofile ,10.15以下版本配置文件是.bash_profile】
MySQL服务的启停和状态的查看
sudo mysql.server stop # 停止MySQL服务
sudo mysql.server restart # 重启MySQL服务
sudo mysql.server status #查看MySQL服务状态
修改密码:(示例:修改为12345678)
mysqladmin -u root -p password
