查看MySQL初始密码、解决MySQL5.7修改密码以及密码认证失败(Your password does not satisfy the current policy requirements)
这几天在遇到Mysql时遇到密码忘记问题和修改密码不成功,为此解决思路如下;
- 1.安装MySQL时的初始密码,忘记MySQL的初始密码时,可以查看MySQL的初始密码;
- 2.修改密码时一直显示不成功,这时候应该查看参数;
1.安装MySQL时的初始密码,忘记MySQL的初始密码时,可以查看MySQL的初始密码;
(1)可以查看到初始root登陆密码
[root@localhost ~]# tmp_pwd=`awk '/temporary password/ {print $NF}' /var/log/mysqld.log`
[root@localhost ~]# echo $tmp_pwd
a&ek+Md)z17p
(2)MySQL的登陆:
[root@localhost ~]# mysql -uroot -pa&ek+Md)z17p
(3)可以通过查看MySQL的初始密码和修改过的密码
[root@localhost ~]# grep password /var/log/mysqld.log
2022-03-26T15:42:40.045397Z 1 [Note] A temporary password is generated for root@localhost: a&ek+Md)z17p
2022-03-26T15:43:32.512355Z 2 [Note] Unknown database 'password'
2022-03-26T15:43:42.436435Z 3 [Note] Unknown database 'password'
2022-03-26T15:44:52.617375Z 5 [Note] Unknown database 'password'
2022-03-26T15:45:06.915842Z 6 [Note] Unknown database 'password'
2022-03-26T15:45:46.370385Z 7 [Note] Unknown database 'passwordMySQL@123'
2022-03-26T15:45:59.527413Z 8 [Note] Access denied for user 'root'@'localhost' (using password: YES)
2.修改密码时一直显示不成功,这时候应该查看参数;
(1)此处修改密码一直报错
[root@localhost ~]# mysqladmin -uroot -p'MySQL@123' password
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
New password:
Confirm new password:
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
mysqladmin: unable to change password; error: 'Your password does not satisfy the current policy requirements'
(2)进入MySQL数据库修改密码也一直报错不成功时
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28
Server version: 5.7.37 MySQL Community Server (GPL)Copyright (c) 2000, 2022, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> ALTER USER root@localhost identified by '123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> set password for root@localhost = password('mysql@123');
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
(3)查看MySQL的密码设置参数
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | | #用于验证密码强度的字典路径;
| validate_password_length | 8 | #密码的最小长度;
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM | #密码的级别;
| validate_password_special_char_count | 1 |
+--------------------------------------+--------+
7 rows in set (0.23 sec)
(4)此时需要修改两条参数信息
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)mysql>
mysql> set global validate_password_length=6;
Query OK, 0 rows affected (0.00 sec)
(5)再次查看数据库参数信息
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 6 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | LOW |
| validate_password_special_char_count | 1 |
+--------------------------------------+-------+
7 rows in set (0.00 sec)
(6)此时可以通过修改数据库的密码
mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.04 sec)
[root@localhost ~]# mysqladmin -uroot -p'123456' password
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
New password:
Confirm new password:
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
查看MySQL初始密码、解决MySQL5.7修改密码以及密码认证失败(Your password does not satisfy the current policy requirements)相关推荐
- MySQL修改root用户密码 报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
修改 root 密码 alter user user() identified by '数字 & 大写字母 & 小写字母 & 特殊符号'; 是不是觉得密码又难有复杂 没事还有办 ...
- mysql修改密码报错:Your password does not satisfy the current policy requirements
这是 mysql 初始化时,使用临时密码,修改自定义密码时,由于自定义密码比较简单,就出现了不符合密码策略的问题. 密码策略问题异常信息: ERROR 1819 (HY000): Your passw ...
- mysql5.7修改密码报错:Your password does not satisfy the current policy requirements
查看全文 http://www.taodudu.cc/news/show-5908879.html 相关文章: mysql5.7授权失败ERROR 1819 (HY000): Your passwor ...
- [修改 Mysql5.7密码策略]Your password does not satisfy the current policy requirements
在修改密码的时候,报错(其实你设置一个复杂一点点长度超过 8 位的就能过了.): mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root ...
- 解决更改mysql密码时报错Your password does not satisfy the current policy requirements问题
输入ALTER USER 'root'@'localhost' IDENTIFIED BY 'python123'; 然后报错Your password does not satisfy the cu ...
- 解决 MySQL 5.7 中 Your password does not satisfy the current policy requirements. 问题
Mac OS X 下通过 Brew 安装 MySQL 后,默认密码为空,然后运行 mysql_secure_installation 命令设置密码 然后我手贱的在密码强度那里输入了 2(真2了...) ...
- mysql8修改密码报:Your password does not satisfy the current policy requirements
mysql修改密码时出现错误: 问题描述 mysql8当执行修改密码语句(两者之一)出现以下错误: 1.ALTER USER USER() IDENTIFIED BY '自己的密码'; 2.ALTER ...
- MySQL解决-Error:Your password does not satisfy the current policy requirements
背景 MySQL版本:Server version: 5.7.27-0ubuntu0.18.04.1 (Ubuntu) 前言 今天打算在MySQL创建用户时遇到了下面这个错误: mysql> C ...
- mysql5.7授权失败ERROR 1819 (HY000): Your password does not satisfy the current policy requirements解决
问题: 在ubuntu 18.04 LTS上安装mysql-server 5.7后进行授权操作: 授权语句: grant all on *.* to root@'%' identified by '1 ...
最新文章
- JavaScript 消息框
- windows下SVN使用 Add指令、Undo Add指令
- FCN制作自己的数据集、训练和测试 caffe
- python的软件叫什么-python是什么软件
- [学习笔记] 乱世之神杀疯了 —— K-D tree
- Unity2019.2中文更新日志速览版
- 使用Perl进行网页数据抓取[初学者简明版]
- Mobile Widget是一种新的手机应用形式吗
- C语言 头哥习题答案截图
- QTP 10.0 破解版下载安装超详细教程
- 微分方程的数值解法与程序实现 pdf_数值计算方法·第三部分
- attachEvent
- 设计心理学之色彩心理学和马斯洛需求层次理论
- 微信小程序广告接入,小程序加广告
- React 组件的三种写法总结
- 大数据技术Flink详解
- 应用fiddler,使用har2case 将api参数转成yaml格式
- Linux 系统设置 : enable 命令详解
- 【硬件】常见芯片封装技术
- [ Python ] 数据挖掘:股票价格