用Homebrew进行安装
brew install mysql@5.7
对mysql进行初始化
1)环境变量配置
vim ~/.bash_profile
添加以下指令:
export PATH=${PATH}:/user/local/Cellar/mysql@5.7/5.7.26/bin
生效
source ~/.bash_profile
2)启动服务
mysql.server start
3)初始化操作
mysql_secure_installation
- Press y|Y for yes, any other key for NO: 【N】,如果选择Y,则需要输入8位密码
- New password: 设置你的密码
- Re-enter new password: 再次输入密码
- Remove anontmous users? 【Y】是否移除不用密码的那个账户
- Disallow root login remotely? 【N】是否禁止远程登录
- Remove test database and access to it? 【Y】 是否删除test库
- Reload privilege tables now? 【Y】是否重新加载
4)进入数据库
mysql -u root -p
5)数据库服务
启动:brew services start mysql@5.7
停止:brew services stop mysql@5.7
MAC 安装mysql
标签:ESS data new users 密码 key load 初始化 rem
本文系统来源:https://www.cnblogs.com/peng-lan/p/11162144.html
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!