Platform |
Notes |
macOS 10.13.4 |
MySQL 5.7.21 |
Solution
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- 安装 MySQL(注意观察可能有错误信息,比如
brew link
失败,可能要先在相应文件夹下开启「写」权限后再手动尝试)
# 现在启动,并加入自启动
brew services start mysql
# 后台启动
mysql.server start
-- CREATE USER 'USERNAME'@'HOST_NAME' IDENTIFIED BY 'PASSWORD';
CREATE USER 'temp_user'@'localhost' IDENTIFIED BY '1234';
-- GRANT PRIVILEGE ON DATABASE_NAME.TABLE_NAME TO 'USERNAME'@'HOST_NAME'
GRANT ALL ON *.* TO 'temp_user'@'localhost';
# 对应上述开启方法
brew services stop mysql
mysql.server stop