Mac安装和卸载mysql5.7

方式一:官网下载安装

安装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(已解决)

上一篇:李彦宏:框计算搜索的盗梦空间 推荐


下一篇:数据结构实验四:图的表示和实现