如何用最简单的方法在 Mac 上安装 MySQL?

在这里插入图片描述

参考文档

  • 官网
    • https://www.mysql.com/
  • 下载
    • https://downloads.mysql.com/archives/community/
  • 安装
    • https://dev.mysql.com/doc/refman/5.7/en/macos-installation.html
  • 重置密码
    • https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

1、下载

进入官网点击【DOWNLOADS】

拉到底 点击【MySQL Community (GPL) Downloads »】

点击【MySQL Community Server】

默认展示最新版的下载入口

点击【Archives】可以进入历史版本的下载入口

这个页面默认展示的是最新版的下载入口
在这里插入图片描述

由于 5.7.31-5.7.38 未提供 macOS 的下载入口,这里我们 Product Version 选择 5.7.30 ,Operating System 选择 macOS 。

2、安装

点击对应的链接下载指定版本的安装包,然后一直下一步安装(安装过程中需要再「系统偏好设置」里进行安全性设置)。

在安装结束之前,安装程序会提示你安装之后的临时密码。
在这里插入图片描述

[Note] A temporary password is generated for root@localhost: xxxx

If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.

3、使用临时密码登录并修改密码

$ mysql -uroot -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 127
Server version: 5.7.30

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.01 sec)

mysql> 

4、设置开机启动

打开「系统偏好设置」拉到底部

勾选 ✅「Automatically Start MySQL Server on Startup」

安装结束。。。

猜你喜欢

转载自blog.csdn.net/uwoerla/article/details/127035808