第一步:找到安裝包地址 —— MySQL 下載地址

第二步:找到 MySQL 5.7.29 版本

第三步: 點擊下載對應的.dmg文件

第四步:點擊下載后,會跳轉到另一個頁面

第五步:下載完成后,雙擊 mysql-5.7.29-macos10.14-x86_64.dmg 文件,進行安裝

第六步:點擊繼續

第七步:點擊繼續

第八步:點擊同意

第九步:點擊安裝(可以更換安裝位置,不知道的可以不用理會,直接點擊安裝),等待安裝

第十步:安裝完成后,到摘要這里時,點擊關閉即可。
第十一步:點擊方框中的圖標

第十二步:點擊“Start MySQL Server”

點擊后可以看到如下圖所示:

第十三步:啟動完成后,打開終端,輸入如下內容,然后按回車鍵
alias mysql=/usr/local/mysql/bin/mysql

第十四步:輸入如下內容,然后按回車鍵
alias mysqladmin=/usr/local/mysql/bin/mysqladmin

第十五步:修改密碼(示例:修改為12345678)
mysqladmin -u root -p password 12345678

備注:
MySQL5.7版本密碼設置
MySQL 設置的密碼中必須至少包含一個大寫字母、一個小寫字母、一個特殊符號、一個數字,密碼長度至少為8個字符
第十六步:終端進入MySQL
輸入如下,輸入后按回車即可
mysql -u root -p12345678
備注:
用戶名為:root
密碼為:12345678
出現如下類似情況,說明進入成功:
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 284
Server version: 5.7.29 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, 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>
如果要退出,輸入"quit"即可

