MySQL数据库安全配置(重置root密码/删除test/禁止root远程/删除匿名)
MySQL数据库不要忘记安全性配置,护云盾分享MySQL数据库安全相关配置,包括MySQL数据库重置root用户密码、删除匿名用户账号、禁止root账号远程登录、删除test库以及对test库的访问权限等操作:

MySQL数据库安全配置
MySQL数据库安全配置
关于MySQL数据库安全配置是很有必要的,护云盾以MySQL 5.7.31版本为例来详细配置下关于MySQL的安全性配置,首先运行下列命令对MySQL进行安全性配置:
1 |
mysql_secure_installation |
重置root用户的密码
1 2 3 4 5 6 7 8 9 10 |
Enter password for user root: #输入上一步获取的root用户初始密码 The 'validate_password' plugin is installed on the server. The subsequent steps will run with the existing configuration of the plugin. 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) : Y #是否更改root用户密码,输入Y New password: #输入新密码,长度为8至30个字符,必须同时包含大小写英文字母、数字和特殊符号。特殊符号可以是()` ~!@#$%^&*-+=|{}[]:;‘<>,.?/ 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 #是否继续操作,输入Y |
删除匿名用户账号
1 2 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 #是否删除匿名用户,输入Y Success. |
禁止root账号远程登录
1 2 |
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y #禁止root远程登录,输入Y Success. |
删除test库以及对test库的访问权限
1 2 3 |
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y #是否删除test库和对它的访问权限,输入Y - Dropping test database... Success. |
重新加载授权表
1 2 3 |
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y #是否重新加载授权表,输入Y Success. All done! |
关于MySQL数据库更多安全性配置,可以参考MySQL官方文档:https://dev.mysql.com/doc/refman/5.7/en/mysql-secure-installation.html
阿里云:阿里云2000元优惠券领取
腾讯云:腾讯云2860元优惠券领取