kingcos / Perspective

📝 Write something with perspectives.
https://kingcos.me
185 stars 15 forks source link

使用 Homebrew 安装 MySQL #8

Open kingcos opened 6 years ago

kingcos commented 6 years ago

Tips - 使用 Homebrew 安装 MySQL

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)"
brew install mysql
# 现在启动,并加入自启动
brew services start mysql

# 后台启动
mysql.server start
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';
# 对应上述开启方法
brew services stop mysql

mysql.server stop