• Linux系统修改数据库密码相关


    Linux系统修改数据库密码相关

    1、更改数据库密码

    1)进入mysql控制台

    mysql -u root –p

    2)输入原密码

    3)切换到mysql数据库

    mysql>use mysql;

    4)修改mysql数据库root密码

    mysql> update user set authentication_string=password("Cw_root2") where user='root';

    Query OK, 1 row affected, 1 warning (0.01 sec)

    Rows matched: 1  Changed: 1  Warnings: 1

    5)刷新mysql权限

    mysql> flush privileges;

    6)退出

    mysql> exit;

    参考文档:https://blog.csdn.net/u011897110/article/details/83343048

    2、展示密码强度相关

    展示密码强度(修改密码时报错—不符合密码要求,查看密码策略)

     SHOW VARIABLES LIKE 'validate_password%';

     

    关于 mysql 密码策略相关参数;

    1)、validate_password_length  固定密码的总长度;

    2)、validate_password_dictionary_file 指定密码验证的文件路径;

    3)、validate_password_mixed_case_count  整个密码中至少要包含大、小写字母的总个数;

    4)、validate_password_number_count  整个密码中至少要包含阿拉伯数字的个数;

    5)、validate_password_policy 指定密码的强度验证等级,默认为 MEDIUM;

    关于 validate_password_policy 的取值:

    0/LOW:只验证长度;

    1/MEDIUM:验证长度、数字、大小写、特殊字符;

    2/STRONG:验证长度、数字、大小写、特殊字符、字典文件;

    参考文档:https://blog.csdn.net/hello_world_qwp/article/details/79551789

    3、配置数据库相关

    a、进入前开启mysql数据库服务

      systemctl start  mysqld.service

    b、顺便查看mysql服务运行状态

      systemctl status mysqld.service  

    c、设置密码等级

      set global validate_password_policy=0;

    d、设置密码长度

      set global validate_password_length=1;

    e、设置数据库登录密码

      ALTER USER 'root'@'localhost' IDENTIFIED BY '你的密码'; 如czsroot

    f、退出

      exit;

    参考文档:https://www.cnblogs.com/xiaomingwang/p/11550732.html

  • 相关阅读:
    Python--初识函数
    Python中的文件操作
    Python中的集合
    Python中的编码和解码
    Python的关键字is和==
    Python中的字典
    Python中的列表和元组
    Python中几种数据的常用内置方法
    Python的编码
    python_while
  • 原文地址:https://www.cnblogs.com/zyp1/p/13305707.html
Copyright © 2020-2023  润新知