zoukankan      html  css  js  c++  java
  • mac下连接本地安装的mysql报错提示密码过期

    前提:

    mac中之前安装了mysql,一段时间没使用,今天使用mysql客户端去连接,报错提示密码过期,原因是mysql5.7之后版本有密码过期这个功能。

    error:

    Your password has expired. To log in you must change it using a client that supports expired passwords.

    打开终端,启动mysql服务:

    sudo /usr/local/mysql/support-files/mysql.server start

    打开另外一个终端:

    输入:

    yingmuxiaogedeMacBook-Air:~ yingmuxiaoge$ alias mysql=/usr/local/mysql/bin/mysql

    yingmuxiaogedeMacBook-Air:~ yingmuxiaoge$ mysql -u root -p

     

    输入如下尝试修改密码失败:

    mysql> update mysql.user set password=PASSWORD('root') where User='root';  

    ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

     

    根据提示信息,使用如下去修改密码:

    mysql> alter user 'root'@'localhost' identified by 'root';

    Query OK, 0 rows affected (0.00 sec)

     

    mysql>  flush privileges;

    Query OK, 0 rows affected (0.01 sec)

     

    修改密码成功。

  • 相关阅读:
    C/C++ 链接汇总
    C# 网页操作
    Win10屏幕开始菜单图标丢失修复方案无意中发现的...
    AI 人工智能
    GIT 命令
    Layui / WEB UI
    PHP DES解密 对应Java SHA1PRNG方式加密
    视频参数介绍及关系《转》
    分布式时系统/服务 数据一致性方案
    JS埋点 小结
  • 原文地址:https://www.cnblogs.com/tom-plus/p/6597737.html
Copyright © 2011-2022 走看看