Mysql 5.7密码过期修改密码
2015-09-14 11:17
671 查看
今天在运行项目的时候出现:“Your password has expired. To log in you must change it using a client that supports expired passwords”这个错误,自己一看才知道是数据库密码过期引起的,这也导致了navicat等工具链接并打不开数据库,唯一的途径只能是修改数据库密码啦!
自己摸索了一早上,在网上也找了好几种方法来解决,最便捷也最好的方法是用命令来修改密码:
1.找到自己mysql安装的路径,如:C:\Program Files\MySQL\MySQL Server 5.7\bin
2.打开命令窗口:cmd 并进入mysql安装的目录bin文件夹下
C:\>cd Program Files\MySQL\MySQL Server 5.7\bin
3.先用之前的密码登陆mysql后台
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecur
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.5-m15-log
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
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.
4.进入mysql后你的所有操作都不会被成功执行,提示如下:
mysql> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
5.上面的提示让你必须修改了密码才能进行后续的操作,现在用命令修改密码:
mysql> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
6.当成功执行上面的sql语句,证明你的mysql密码修改成功,即你可以用新的密码来使用数据库啦
自己摸索了一早上,在网上也找了好几种方法来解决,最便捷也最好的方法是用命令来修改密码:
1.找到自己mysql安装的路径,如:C:\Program Files\MySQL\MySQL Server 5.7\bin
2.打开命令窗口:cmd 并进入mysql安装的目录bin文件夹下
C:\>cd Program Files\MySQL\MySQL Server 5.7\bin
3.先用之前的密码登陆mysql后台
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecur
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.5-m15-log
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
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.
4.进入mysql后你的所有操作都不会被成功执行,提示如下:
mysql> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
5.上面的提示让你必须修改了密码才能进行后续的操作,现在用命令修改密码:
mysql> show databases;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
6.当成功执行上面的sql语句,证明你的mysql密码修改成功,即你可以用新的密码来使用数据库啦
相关文章推荐
- MySQL中的integer 数据类型
- MySQL存储过程
- mysql中int、bigint、smallint 和 tinyint的区别与长度
- mysql load data 导出、导入 csv
- source命令执行SQL脚本文件
- MySQL创建用户及权限控制
- MySQL管理数据表
- linux下mysql添加用户
- mysql procedure
- mysql触发器
- MySQL 备份和恢复策略
- mac下安装mysql(转载)
- mysql 修改编码 Linux/Mac/Unix/通用(杜绝修改后无法启动的情况!)
- MySQL数据的导出、导入(mysql内部命令:mysqldump、mysql)
- mysql数据行转列
- Linux下修改MySQL编码的方法
- MySQL Server 日志
- MySQL 安全事宜
- MySQL 备份与恢复