前言

最近很多新入职的同事问这个问题,特别是通过 homebrew 自动安装的 mysql ,其版本默认已经是 8.0 了,由于增加了一些安全策略等限制,所以修改用户密码会稍微麻烦些,索性就把这个总结贴一下吧。

下面话不多说了,来一起看看详细的介绍吧

步骤如下:

1、首先查看 root 用户相关信息,在 mysql 数据库的 user 表中:

select host, user, authentication_string, plugin from user;

user:当前数据库的用户名;

authentication_string:用户密码;在mysql 5.7.9以后废弃了password字段和password()函数;

plugin:密码加密方式;

如果发现 root 用户的 authentication_string 字段下有内容,先将其设置为空:

use mysql;update user set authentication_string='' where user='root';
mysql.server stop
mysql.server start
mysql -u root -ppasswrod:

4、进入 mysql 库,使用 ALTER 修改 root 用户密码:

ALTER user 'root' IDENTIFIED BY '123456' ;
set global validate_password.length = 6 ;set global validate_password.policy = 'LOW';FLUSH PRIVILEGES;
SHOW VARIABLES LIKE 'validate_password.%';

更多相关文章

  1. 发现 developer.android.com 官网的一个单词错误:
  2. 背部如何画好?动漫人物背部画法步骤
  3. android 命令(adb shell)进入指定模拟器或设备
  4. Android--WebView+HTML+Javascript
  5. Android绘制简单折线图的步骤
  6. Android(安卓)Junit 单元测试步骤
  7. Android(安卓)TextToSpeech语音播放文本
  8. Android中LiveData+Room+Paging简单实现步骤
  9. android sdk支持ant自动构建jar步骤

随机推荐

  1. Android Service总结06 之AIDL
  2. 修改android 系统设置 android 版本
  3. EditText 相关功能
  4. Android(安卓)4.0开发环境搭建和测试
  5. android 系统(13)---Android O treble 新增
  6. Android之可收缩展开列表ExpandableList
  7. android修改底层键值
  8. android视频播放器源码分析
  9. Android(安卓)Touch事件分析
  10. WebKit For Android