brew 安装 mysql

2022-01-14/2022-01-14
0 评论 24 浏览

参考文档:
Mac brew 安装mysql
Your password does not satisfy the current policy requirements

1. 定位软件包

1# 搜索 mysql 软件包
2brew search mysql  # 找打了 mysql   和  mysql@5.7
3
4# 查看信息
5brew info mysql # 发现为 8.0 版本

2. 安装

1# 安装需要的版本
2brew install mysql@5.7

安装成功后,如图所示:

20190521154126136

我们需要配置下环境:

1export PATH=/usr/local/opt/mysql@5.7/bin:$PATH >> ~/.zshrc

然后执行:

1mysql_secure_installation

大致交互如下:

 1Securing the MySQL server deployment.
 2
 3 
 4
 5Connecting to MySQL using a blank password.
 6
 7 
 8
 9VALIDATE PASSWORD COMPONENT can be used to test passwords
10
11and improve security. It checks the strength of password
12
13and allows the users to set only those passwords which are
14
15secure enough. Would you like to setup VALIDATE PASSWORD component?
16
17 
18
19Press y|Y for Yes, any other key for No: n    // 这个选 yes 的话密码长度就必须要设置为8位以上,但我只想要6位的
20
21Please set the password for root here.
22
23New password:
24
25Re-enter new password:
26
27By default, a MySQL installation has an anonymous user,
28
29allowing anyone to log into MySQL without having to have
30
31a user account created for them. This is intended only for
32
33testing, and to make the installation go a bit smoother.
34
35You should remove them before moving into a production
36
37environment.
38
39 
40
41Remove anonymous users? (Press y|Y for Yes, any other key for No) : n          // 移除不用密码的那个账户
42
43Success.
44
45 
46
47Normally, root should only be allowed to connect from
48
49'localhost'. This ensures that someone cannot guess at
50
51the root password from the network.
52
53 
54
55Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n      //不接受root远程登录账号
56
57 
58
59... skipping.
60
61By default, MySQL comes with a database named 'test' that
62
63anyone can access. This is also intended only for testing,
64
65and should be removed before moving into a production
66
67environment.
68
69 
70
71 
72
73Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n     //删除test数据库
74
75- Dropping test database...
76
77Success.
78
79 
80
81- Removing privileges on test database...
82
83Success.
84
85 
86
87Reloading the privilege tables will ensure that all changes
88
89made so far will take effect immediately.
90
91 
92
93Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y   // 重新加载权限表
94
95Success.

启动服务

1brew services start mysql@5.7

标题:brew 安装 mysql
作者:Rainsheep
地址:https://www.rainsheep.cn/articles/2022/01/14/1642143946987.html

评论
发表评论
       
       
取消