mac 環境的brew及其他軟件的安裝

brew相當於linux下的yum,能非常方便得管理各種軟件包,這裏整理一下brew安裝及其他軟件的安裝。

brew的安裝:

1.打開命令行工具

2.安裝brew   命令爲:ruby -e "$(curl --insecure -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3.如網絡不行,出現錯誤,就先卸載之前的安裝  命令爲:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

4.再次重複2步驟 

5.安裝成功 ,輸入brew -v命令,如果有版本顯示則說明安裝成功,如果提示-bash: brew: command not found mac  則需要執行

sudo vim .bash_profile

並加入配置export PATH=/usr/local/bin:$PATH,最後source .bash_profile使配置修改生效,這樣就安裝完了brew。

6.如果覺得官方太慢,可以切換國內鏡像,使用的比較多的就是中科大的源

(1)替換默認源 
第一步:替換brew.git

cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
第二步:替換homebrew-core.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd 
brew update
(2)替換Homebrew Bottles源

對於bash用戶:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

 

 

brew下的mysql安裝:

1.$ brew install mysql

2.開啓或關閉mysql命令   mysql.service start(stop)

3.配置mysql信息($ mysql_secure_installation)

Press y|Y for Yes, any other key for No: N   // 這個選yes的話密碼長度就必須要設置爲8位以上
New password:             // 設置密碼
Re-enter new password:     // 再一次確認密碼
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y    // 移除不用密碼的那個賬戶
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n  //不接受root遠程登錄賬號
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y  //刪除text數據庫

4.mysql8 navicat 連接 mysql 出現Client does not support authentication protocol requested by server解決方法:

USE mysql; 
alter user ‘root’@’localhost’ identified with mysql_native_password by ‘root’; 
FLUSH PRIVILEGES;

5.之後開啓或關閉命令可以用:

# 啓動 mysql, 並設置爲開機啓動
brew services start mysql
# 關閉 mysql
brew services stop mysql
# 重啓 mysql
brew services restart mysql

 

 

brew安裝redis

1.$ brew install redis

2.$ redis-server  啓動redis服務

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章