• 修改mysql 8.0.16 root 密码--mac


    https://blog.csdn.net/HECTOR_1368391900/article/details/90732097

    https://my.oschina.net/u/3251146/blog/2885657

    序言:

          如果是首次安装mysql数据,可以查看日志文件,能找到随机的密码,日志文件在配置文件(/etc/my.cnf)

          less  /var/log/mysqld.log

        如果忘记root密码,重复下面的步骤 能够重置root密码

    1. 修改Mysql配置文件

           vim /etc/my.cnf

         添加如下内容:

          default-authentication-plugin=mysql_native_password
          symbolic-links=0
          skip-grant-tables

    2.重启mysql服务

        systemctl restart mysqld

    3.无密码登录

       mysql -u root -p 
       按 enter键 进入

    4.修改密码

        use mysql;
        select user,host,authentication_string from user;
        ### 密码设置为空
        update user set authentication_string='' where user='root';

         flush privileges;
         quit;

    5.退出,重新登录 进行修改密码

        去掉 步骤1 配置的内容 跳过密码登录进去的
        #default-authentication-plugin=mysql_native_password
        #symbolic-links=0
        #skip-grant-tables
        
        重复步骤2 步骤3

    6.修改root密码

        ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'RootPwd@123456';

        ### 密码必须包含两个大写字母 、特殊符号、 字母、 数字

    7.开放远程登录

       update user set host ='%' where user='root';

       ### 同时也要检查 云服务器的安全组是否开启 mysql(3306) 端口号

       ### 也要检查 防火墙 开启对外  mysql(3306) 端口号

  • 相关阅读:
    一个好的时间函数
    Codeforces 785E. Anton and Permutation
    Codeforces 785 D. Anton and School
    Codeforces 510 E. Fox And Dinner
    Codeforces 242 E. XOR on Segment
    Codeforces 629 E. Famil Door and Roads
    Codeforces 600E. Lomsat gelral(Dsu on tree学习)
    Codeforces 438D The Child and Sequence
    Codeforces 729E Subordinates
    【ATcoder】D
  • 原文地址:https://www.cnblogs.com/feng9exe/p/11320974.html
Copyright © 2020-2023  润新知