MariaDB 開啓密碼複雜度和密碼過期策略 MariaDB 版本:10.4.21及以上 sql語句設置方式(重啓失效) #安裝啓用 INSTALL SONAME 'simple_password_check'; #檢查驗證 show variables like '%password%'; set global simple_password_check_minimal_length=8; set global simple_password_check_other_characters=1; set global simple_password_check_letters_same_case=1; set global simple_password_check_digits=1; 配置文件設置方式 vim /etc/my.cnf.d/server.cnf #配置文件添加如下參數 [mysqld] #加載密碼複雜度審計插件 plugin-load=simple_password_check.so #密碼長度,默認8位 simple_password_check_minimal_length=8 #特殊符號,1代表至少1位 simple_password_check_other_characters=1 #字母數,1代表至少1位 simple_password_check_letters_same_case=1 #數字數,1代表至少1位 simple_password_check_digits=1 #默認密碼過期時間 單位天 每過180天就要修改密碼 default_password_lifetime=180 #最大錯誤登錄次數 max_password_errors=5 #sql語句設置用戶密碼過期時間 ##密碼有效期設置 sql語句 create user 'test'@'localhosts' identified by '123QWe!@#' password expire interval 30 day; #30天過期 create user 'test'@'localhost' password expire never; #永不過期 alter user 'test'@'localhost' password expire interval 120 DAY; #修改爲120天過期 alter user 'test'@'localhost' password expire never; #修改爲永不過期