Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 Homebrew 安装 MySQL #8

Open
kingcos opened this issue May 5, 2018 · 0 comments
Open

使用 Homebrew 安装 MySQL #8

kingcos opened this issue May 5, 2018 · 0 comments
Assignees
Labels
[Tips] 即提示

Comments

@kingcos
Copy link
Owner

kingcos commented May 5, 2018

Tips - 使用 Homebrew 安装 MySQL

Platform Notes
macOS 10.13.4 MySQL 5.7.21

Solution

  • 安装 Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 安装 MySQL(注意观察可能有错误信息,比如 brew link 失败,可能要先在相应文件夹下开启「写」权限后再手动尝试)
brew install mysql
  • 开启 MySQL 服务
# 现在启动,并加入自启动
brew services start mysql

# 后台启动
mysql.server start
  • 连接 MySQL(默认端口为 3306)
mysql -uroot
  • 创建用户并授权
-- 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';
  • 关闭 MySQL 服务
# 对应上述开启方法
brew services stop mysql

mysql.server stop
@kingcos kingcos added the [Tips] 即提示 label May 5, 2018
@kingcos kingcos self-assigned this May 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tips] 即提示
Projects
None yet
Development

No branches or pull requests

1 participant