天天看點

Mac安裝和解除安裝mysql5.7方式一:官網下載下傳安裝方式二:homebrew 安裝 mysql

方式一:官網下載下傳安裝

安裝mysql

mysql官網下載下傳:

https://dev.mysql.com/downloads/mysql/

系統偏好設定 會出現mysql的圖示

删除mysql

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
# 有就删除,沒有就算
sudo vim /etc/hostconfig  (removed the line MYSQLCOM=-YES-)
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*      

方式二:homebrew 安裝 mysql

安裝homebrew

brew官網:

https://brew.sh/index_zh-cn

方式一:

安裝homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"      

解除安裝homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"        

方式二:

如果安裝失敗,報錯:permission denied

1、可以先下載下傳

git下載下傳:

git clone https://github.com/Homebrew/brew      

或者github下載下傳:

https://github.com/Homebrew/brew

2、移動項目檔案

cd brew  # 進入剛下載下傳的檔案目錄
sudo mv bin/brew /usr/local/bin
sudo mv Library /usr/local
sudo mv share /usr/local
brew  # 檢查成功      

安裝解除安裝mysql

安裝

brew install mysql      

啟動mysql

mysql.server start      

進入

mysql -uroot      

修改mysql密碼

mysql> set password for root@localhost = password('newpassword');       

解除安裝

brew uninstall mysql 或者 brew remove mysql      

參考:

1. 

不管會不會,我是這樣在mac上n次安裝與解除安裝mysql的

2. 

從Mac系統中解除安裝MySql

3. 

mac安裝以及删除mysql5.7

4. 

mac 上安裝brew,permission denied(已解決)

繼續閱讀