等保MySQL账号安全要求

1.是否满足长度和复杂度要求,是否勾选强制实施密码策略和强制失败策略。
2.数据库目前使用的账户有哪些,账户的权限分配情况。
3.是否开启审计功能,是否保存了6个月内的审计记录,或部署了第三方审计系统。
4.数据库数据的备份策略。
5.是否收集了个人信息,是否对数据库中保存的个人信息进行加密处理。


SELECT VERSION(); 
select user,host from mysql.user;
复杂度
-- 安装 INSTALL PLUGIN validate_password SONAME 'validate_password.so';
-- 卸载 UNINSTALL PLUGIN  validate_password;
show variables like 'validate_password%';
-- SET GLOBAL default_password_lifetime = 90;
show global variables like 'default_password_lifetime';
登录失败
show global variables like '%max_connect_errors%';
show variables like '%connection_control%';
登录超时
show variables like "%wait_timeout%";
远程管理
show variables like "%have_ssl%";

访问控制:
select user,host from mysql.user;
show grants for 'username(用户名)'@’host’;

审计
-- 开启  set GLOBAL  general_log=1;
-- 关闭  set GLOBAL  general_log=0;
show global variables like '%general%';
show variables like 'log_%';
show global variables like '%audit%';  (未安装插件会报错)  
show global variables like '%audit_json_file%'; 
select * from general_log;



会话控制限制登录次数
mysql> install plugin connection_control soname "connection_control.so";
mysql> install plugin connection_control_failed_login_attempts soname "connection_control.so";

卸载:
mysql> UNINSTALL plugin connection_control  ;
mysql> UNINSTALL plugin connection_control_failed_login_attempts ;


audit 开启
下载地址 https://bintray.com/mcafee/mysql-audit-plugin/release#files
查看MySQL的插件目录:

> show variables like 'plugin_dir';
+---------------+------------------------------+
| Variable_name | Value                        |
+---------------+------------------------------+
| plugin_dir    | /usr/local/mysql/lib/plugin/ |
+---------------+------------------------------+

复制库文件到MySQL库目录下:

# cp libaudit_plugin.so /usr/local/mysql/lib/plugin/
# chmod a+x /usr/local/mysql/lib/plugin/libaudit_plugin.so

进入mysql命令窗口,安装插件:

> install plugin audit soname 'libaudit_plugin.so';
原文地址:https://www.cnblogs.com/l10n/p/14096333.html