当前位置:   article > 正文

macOs安装mysql_estimated strength of the password: 50 do you wish

estimated strength of the password: 50 do you wish to continue with the pass

一、macOS下安装myql

通过brew安装完mysql后执行以下命令

1.启动服务
mysql.server start
  • 1
2.初始化
mysql_secure_installation
  • 1
3.初始化设置说明
Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN 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 plugin?

Press y|Y for Yes, any other key for No: y 
//是否使用VALIDATE PASSWORD PLUGIN,这个看自己了

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                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 
//1(这里我选了1,即MEDIUM,密码需要有大小写字母、数字、特殊符号)
Please set the password for root here.

New password: (输入你的密码)
Re-enter new password: (再次输入你的密码)

Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
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.


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) : (是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止)

 ... skipping.
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) : (是否删除test数据库,直接回车)

 ... skipping.
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) : (是否重新加载权限表,直接回车)

 ... skipping.
All done!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63

二、连接问题

在mac os环境下,安装了mysql之后出现连接不成功(第三方软件),通常是因为新版的mysql中新增了不同的密码加密机制,我们需要将加密机制改为旧版本的。

1.官网下载软件安装的情况

到系统偏好设置中找到mysql,到mysql服务中点击Initialize Database,勾选Use legacy password,重新启动服务,连接成功。

2.brew安装的情况

如果是通过brew安装的mysql,在系统偏好设置中找不到mysql图标,需要通过命令行来修改,linux系统中也遇到过同类型的问题

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'NewPassword@123456';

FLUSH PRIVILEGES;
  • 1
  • 2
  • 3

这里设置密码很蛋疼,是因为mysql默认密码强度为中等强度。需要大小写、特殊字符、数字,可以先通过两个全局设置改变,而因为新旧版本的mysql密码教养规则不同,我们可以通过SHOW VARIABLES LIKE 'validate_password%';
来查看对应的规则是什么然后通过以下代码修改强度跟长度即可

set global validate_password.policy = 0
set global validate_password.length = 4
  • 1
  • 2

但是!我发现一开始初始化的时候,如果选择了使用VALIDATE PASSWORD PLUGIN插件并进行设置之后,再做修改似乎是没有效果的

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/768566
推荐阅读
相关标签
  

闽ICP备14008679号