Homebrew安装mysql

1.安装mysql

# brew安装mysql
brew install mysql

2.启动服务

brew services start mysql

3.安全启动向导设置密码

mysql_secure_installation
Securing the MySQL server deployment.

。。。。。
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No:  # y表示密码长度必须要设置为8位以上
Please set the password for root here.

New password:  # 给root设置密码

Re-enter new password:  # 确认密码

。。。。。。
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y   # 移除不用密码的那个账户
Success.


。。。。
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n # n表示允许root远程登录

。。。。。。
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y # 删除test库以及对test库的访问权限。
 - Dropping test database...
Success.

。。。。。。
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y # 是否重新加载权限表
Success.

All done! 

3.使用默认免密登陆设置密码

mysql -u root
alter user 'root'@'localhost' identified with 你的密码 by 'root';

4查看.my.cnf配置文件

mysqld --help --verbose | less

brew安装的mysql必须使用brew命令,mysql.server stop不起作用

# 启动 mysql, 并设置为开机启动
brew services start mysql

# 关闭 mysql
brew services stop mysql

# 重启 mysql
brew services restart mysql
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

愛沢かりん

感谢您对我的支持

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值