MAC 安装mysql
Posted peng-lan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MAC 安装mysql相关的知识,希望对你有一定的参考价值。
用Homebrew进行安装
brew install [email protected]
对mysql进行初始化
1)环境变量配置
vim ~/.bash_profile
添加以下指令:
export PATH=$PATH:/user/local/Cellar/[email protected]/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 [email protected]
停止:brew services stop [email protected]
以上是关于MAC 安装mysql的主要内容,如果未能解决你的问题,请参考以下文章
mac 安装mysql5.6后,为啥在/usr/local/下有两个mysql目录