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) 端口号

  • 相关阅读:
    Vue-router 报NavigationDuplicated的可能解决方案
    go 数据类型转换
    在vscode 之中使用 GO MOD
    javascript格式化
    Mac node-sass 安装失败“v8::String::Utf8Value”
    Django 使用gunicorn 和 supervisord部署
    关于windows上的账号(权限)切换
    python中的global关键字
    暂时性的小总结
    windwos 安装下kafka的安装使用
  • 原文地址:https://www.cnblogs.com/feng9exe/p/11320974.html
Copyright © 2011-2022 走看看