如果本文对您有帮助,或者节约了您的时间,欢迎打赏瓶饮料,建立下友谊关系。
本博客不欢迎:各种镜像采集行为。请尊重原创文章内容,转载请保留链接信息。

苏南大叔的测试机上,用brew安装的mysql默认密码还是空的。所以,这里,用mysql的安全设置命令进行了下设置。大家可以一并来学习一下这个命令。

mysql_secure_installation

整个过程比较简单,需要简单的和终端进行些交互。下面的截图是建立于纯新安装的无密码的mysql环境。如果您的mysql环境是有密码的,或者进行过类似设置,界面是不一样的。有一定的区别。

建立密码验证插件

mysql安全设置命令mysql_secure_installation使用指南 - 000

选择密码规则

mysql安全设置命令mysql_secure_installation使用指南 - 001

创建符合上述选择好规则的新密码

mysql安全设置命令mysql_secure_installation使用指南 - 002

删除匿名用户

mysql安全设置命令mysql_secure_installation使用指南 - 003

禁用远程root登录

mysql安全设置命令mysql_secure_installation使用指南 - 004

删除测试数据表

mysql安全设置命令mysql_secure_installation使用指南 - 005

done

mysql安全设置命令mysql_secure_installation使用指南 - 006

localhost:~ sunan$ sudo mysql_secure_installation
Password:

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

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
Please set the password for root here.

New password:

Re-enter new password:
Sorry, passwords do not match.

New password:

Re-enter new password:

Estimated strength of the password: 25
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
 ... Failed! Error: Your password does not satisfy the current policy requirements

New password:

Re-enter new password:
Sorry, passwords do not match.

New password:

Re-enter new password:

Estimated strength of the password: 50
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) : y
Success.

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.

 - Removing privileges on 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! 

更多由苏南大叔带来的mysql相关内容,请点击查看:https://newsn.net/tag/mysql/

本站采用创作共用版权协议, 要求署名、非商业用途和相同方式共享。
转载本站内容必须也遵循“署名-非商业用途-相同方式共享”的创作共用协议。
程序如此灵动~》下所有原创文章,如被用于商业用途,请您按规定支付稿费。