• MYSQL8.0修改密码的一些疑问


    mysql安装以后,默认密码为空,可以使用

    mysqld --initial
    

    Mysql 提供了两种基于SHA-256的密码验证的插件:

    sha256_password  基于基本的sha-256 验证
    caching_sha2_password Implements SHA-256 authentication (like sha256_password), but uses caching on the server side for better performance and has additional features for wider applicability.
    

    查看mysql使用的密码插件:

    mysql> show variables like '%default_authentication_plugin%';
    +-------------------------------+-----------------------+
    | Variable_name                 | Value                 |
    +-------------------------------+-----------------------+
    | default_authentication_plugin | caching_sha2_password |
    +-------------------------------+-----------------------+
    1 row in set (0.01 sec)
    

    那么修改密码的时候,我们就要这样:

      alter user 'root'@'localhost' identified with caching_sha2_password by 'your_new_password';  
    

    如果你的root密码原来是空密码,那么使用select语句查看:

    mysql> select authentication_string from user;
    +------------------------------------------------------------------------+
    | authentication_string                                                  |
    +------------------------------------------------------------------------+
    | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
    | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
    | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
    | $A$005$4<+yQ2yNzb+L{TFc{T.xxxoMky8g1F0KbCQeyHOZ8JSO/NWydKhRGnhCVxyn/ |
    +------------------------------------------------------------------------+
    5 rows in set (0.00 sec)
    

    就变成了有密码...
    然后使用新密码登陆mysql,发现已经成功了。

    联系我->邮件写信
  • 相关阅读:
    Python中的浅复制、深复制
    Python
    CSS中
    Fluent_Python_Part3函数即对象,05-1class-func,一等函数,函数即对象
    Python
    本地简单HTTP服务器
    Fluent_Python_Part2数据结构,04-text-byte,文本和字节序列
    Fluent_Python_Part2数据结构,03-dict-set,字典和集合
    Fluent_Python_Part2数据结构,02-array-seq,序列类型
    Codeforces 246E Blood Cousins Return(树上启发式合并)
  • 原文地址:https://www.cnblogs.com/bing-yu12/p/14694261.html
Copyright © 2020-2023  润新知