准备工作:安装Homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"复制代码
brew info mysql
brew install mysql(安装mysql)
brew tap homebrew/services(安装brew服务管理)
brew services start mysql(启动mysql服务)
brew services list(查看服务列表)
mysqladmin -u root password 'yourpassword'(设置root密码)
mysql -u root -p (登录mysql)