当前位置: 首页 > news >正文

MacBook 使用 brew 安装 MySQL

在这里插入图片描述

目录

  • (1)准备工作
    • 1.1 更新 brew
  • (2)正式安装
    • 2.1 安装MySQL:
    • 2.2 启动mysql
  • (3)初始化数据库
    • 3.1 选择验证密码组件
    • 3.2 密码强度
    • 3.3 删除匿名用户
    • 3.4 禁用root用户远程连接
    • 3.5 删除test数据库
    • 3.6 重新载入权限表

(1)准备工作

1.1 更新 brew

更新Homebrew的库:

brew update

(2)正式安装

2.1 安装MySQL:

brew install mysql

在这里插入图片描述

2.2 启动mysql

brew services start mysql

(3)初始化数据库

官方建议刚安装好数据库的时候都要初始化数据,因为这样数据库会更加安全

mysql_secure_installation

3.1 选择验证密码组件

Securing the MySQL server deployment.Connecting to MySQL using a blank password.VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?Press y|Y for Yes, any other key for No: y

验证密码组件可用于测试密码,并提高安全性。它检查密码的强度,并允许用户仅设置以下密码足够安全。您想设置验证密码组件吗?
一般都选择y,我输入的 y

3.2 密码强度

There are three levels of password validation policy:LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  filePlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Please set the password for root here.

有三种密码强度的策略
低级密码:密码长度大于等于8
中级密码:密码长度大于等于8,并且是数字,大小写混合,特殊字符
强密码:密码长度大于等于8,并且数字,大小写混合,特殊字符和字典文件
我选择的是1,中级密码强度,输入完之后会再输入root密码

3.3 删除匿名用户

By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

MySQL安装默认具有匿名用户,允许任何人登录MySQL,而无需为他们创建的用户帐户。这仅适用于测试,并使安装过程更加顺利。在进入生产之前,您应该删除它们环境。
一般选择 y

3.4 禁用root用户远程连接

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

通常,只允许root连接“本地主机”。这确保了别人不能通过网络访问你的root用户,我是本地安装的 mysql,因此就选择y,就是不允许root用户远程连接

3.5 删除test数据库

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y- Dropping test database...
Success.

默认情况下,MySQL附带了一个名为“test”的数据库,任何人都可以访问。这也仅用于测试,在投入生产之前,应将其删除。
我选择的删除这个test库

3.6 重新载入权限表

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!

重新加载权限表将确保迄今为止所做的所有更改立即生效。
选择y,之后就会重新刷新权限,至此mysql就安装完成了

http://www.lryc.cn/news/453457.html

相关文章:

  • java中有两个list列表,尽量少的去循环
  • Java中的状态机实现:使用Spring State Machine管理复杂状态流转
  • [Notes] Computer Network - Overwiew
  • MyBatisPlus——学习笔记
  • 运维自动化shell脚本总结
  • 前端学习第三天笔记 JavaScript JavaScript的引入 数据类型 运算符 条件语句 字符串
  • C++教程一口气讲完!(万字讲解)( ̄y▽ ̄)╭ Ohohoho... 下
  • unity软件安装教程
  • [大语言模型-论文精读] 更大且更可指导的语言模型变得不那么可靠
  • 云手机可以解决TikTok运营的哪些问题?
  • Redis基础三(redis的高级配置)
  • Telnet、SSH、RDP和VNC
  • FiBiNET模型实现推荐算法
  • 影刀RPA:Excel内容填充指令
  • Threejs创建正多边体
  • 链表——单链表
  • 【YOLO学习】YOLOv5口罩检测实战
  • 场景题1-设计redis的key和value的原则
  • Shell-使用函数
  • Git介绍--github/gitee/gitlab使用
  • 【ubuntu】【VirtualBox】VirtualBox无法加载USB移动设备的解决方法(支持U盘启动盘)
  • Koa2+mongodb项目实战1(项目搭建)
  • Pyhton爬虫使用Selenium实现浏览器自动化操作抓取网页
  • 矩阵学习过程中的一些思考
  • 初识Django
  • VirtualBox虚拟机连接宿主机并能够上网(小白向)
  • 深度学习每周学习总结J1(ResNet-50算法实战与解析 - 鸟类识别)
  • 商家营销工具架构升级总结
  • 移动硬盘无法读取:问题解析与高效数据恢复实战
  • 20241005给荣品RD-RK3588-AHD开发板刷Rockchip原厂的Android12时使用iperf3测网速