2022-07-22T14:00:25.080112Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: ujNHaIFXu0:i
这个密码(ujNHaIFXu0:i)就是运行Mysql安全安装指令的密码,如下:
➜ ~ mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:(这里要输入那个密码,不如会如下报错)
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
# 下面是正确输入密码后的配置过程。。。
➜ ~ mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
The existing password for the user account root has expired. Please set a new password.
New password:
Re-enter new 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
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: 0
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
... skipping.
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) : 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) : n
... 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) : y
Success.
All done!
#先用你的root用户登录,然后执行就行,主要是后面三个,理论上你安装初始化的时候策略已经是LOW了。。。
#降低安全策略等级
set global validate_password.policy=LOW;
#降低密码长度需求
set global validate_password.length=4;
#设置英文字母(包含大小写)最小长度
set global validate_password.mixed_case_count=0;
#设置特殊字符最小长度
set global validate_password.special_char_count=0;