zoukankan      html  css  js  c++  java
  • 修改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) 端口号

  • 相关阅读:
    阅读心得10:《京东咚咚架构演进 》
    hadoop beginning
    ubuntu docker
    Ubuntu学习——第一篇
    flexsim diary
    apollo 3.0 硬件系统
    这是一份详细的Apollo自动驾驶平台上手指南
    详解百度Apollo感知技术、高精地图和小度车载系统
    Apollo 2.5推基于动态的实时相对地图解决方案
    Apollo在功能安全方面的探索
  • 原文地址:https://www.cnblogs.com/feng9exe/p/11320974.html
Copyright © 2011-2022 走看看