日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

在Mac OS环境下安装MySQL服务

發布時間:2025/4/16 数据库 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 在Mac OS环境下安装MySQL服务 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

                  在Mac OS環境下安裝MySQL服務

                                         作者:尹正杰?

版權聲明:原創作品,謝絕轉載!否則將追究法律責任。

?

?

  我之前介紹過window環境下安裝mysql服務,以及在Linux環境下安裝mysql服務,今天我要給大家介紹的是在Mac環境下安裝mysql服務。其實安裝mysql服務我們也可以像Linux那樣,使用brew命令進行安裝,但我們此處使用的是綠色方式安裝。

?

?

一.下載mysql服務

1>.登錄mysql的下載列表

  下載地址:https://dev.mysql.com/downloads/mysql/。如下圖所示,點擊標紅的標簽。

?2>.下載DMG版本的mysql安裝包

?

3>.跳過登錄直接下載mysql服務即可

?

二.安裝mysql服務

1>.雙擊運行下載好的安裝包,點擊繼續

2>.閱讀軟件許可協議后,點擊繼續

?

3>.點擊安裝

?

4>.記住安裝的數據庫的初始密碼(如下圖所示,我這里的初始化密碼是:M7Rju)ofMFMb)

?

5>.安裝成功

?

?

三.啟動mysql服務

1>.進入mysql的系統偏好設置

2>.點擊mysql服務

?

3>.啟動mysql服務

?

4>. 服務啟動成功

?

?

?

四.修改mysql的默認密碼?

1>.登錄mysql服務器

?

2>.更改mysql的默認密碼

set password for 'root'@'localhost' = PASSWORD('yinzhengjie');

?

3>.使用修改后的密碼登錄服務器?

?

?

五>.授權mysql遠程主機登錄

1>.授權只運行的主機

[尹正杰到此一游:~ yinzhengjie$ mysql -u root -pyinzhengjie 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 35 Server version: 5.7.24 MySQL Community Server (GPL)Copyright (c) 2000, 2018, 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> [mysql> [mysql> [mysql> [mysql> grant all privileges on *.* to 'root'@'172.30.1.%' identified by 'yinzhengjie'; Query OK, 0 rows affected, 1 warning (0.00 sec)[mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec)[mysql> quit Bye [尹正杰到此一游:~ yinzhengjie$

?

2>.查看宿主機的IP地址

?

3>.使用Guest虛擬機登錄宿主機?

?

六.安裝MySQL8.0.x的區別

1>.MySQL加密方式的選擇(之前的安裝步驟和上面MySQL5.7的安裝方式基本雷同,我這里就省略了~)

2>.自定義root的密碼:

3>.安裝成功后,點擊完成

4>.在MacOS到系統偏好設置進入到MySQL到管理界面

5>.查看MySQL的默認配置

?

6>.登陸MySQL服務器?

7>.將MySQL的安裝路徑手動添加到環境變量中

bogon:~ yinzhengjie$ vi ~/.bash_profile bogon:~ yinzhengjie$ bogon:~ yinzhengjie$ source ~/.bash_profile bogon:~ yinzhengjie$ bogon:~ yinzhengjie$ cat ~/.bash_profile | grep PATH # Setting PATH for Python 3.6 PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}:/usr/local/mysql/bin" export PATH bogon:~ yinzhengjie$ bogon:~ yinzhengjie$ mysql -uroot -pyinzhengjie 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 12 Server version: 8.0.14 MySQL Community Server - GPLCopyright (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> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec)mysql>

8>.創建MySQL到登陸用戶

mysql> CREATE USER 'yinzhengjie'@'172.30.1.10%' IDENTIFIED BY 'yinzhengjie'; Query OK, 0 rows affected (0.01 sec)mysql> mysql> GRANT ALL PRIVILEGES ON *.* TO 'yinzhengjie'@'172.30.1.10%' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec)mysql> [root@node110 ~]# hostname node110.yinzhengjie.org.cn [root@node110 ~]# [root@node110 ~]# hostname -i 172.30.1.110 [root@node110 ~]# [root@node110 ~]# mysql -h 172.30.1.2 -uyinzhengjie -pyinzhengjie mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 1130 (HY000): Host '172.30.1.110' is not allowed to connect to this MySQL server [root@node110 ~]# [root@node110 ~]# 使用 “node110.yinzhengjie.org.cn” 節點登陸 [root@node105 ~]# hostname node105.yinzhengjie.org.cn [root@node105 ~]# [root@node105 ~]# hostname -i 172.30.1.105 [root@node105 ~]# [root@node105 ~]# mysql -h 172.30.1.2 -uyinzhengjie -pyinzhengjie 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 14 Server version: 8.0.14 MySQL Community Server - GPLCopyright (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> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec)mysql> quit Bye [root@node105 ~]# 使用 “node105.yinzhengjie.org.cn” 節點登陸

?

轉載于:https://www.cnblogs.com/yinzhengjie/p/10125609.html

總結

以上是生活随笔為你收集整理的在Mac OS环境下安装MySQL服务的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。