【小平工作日志】mysql找回密码、更改密码系列问题
2016-11-01 00:00
344 查看
1.先修改mysql配置。在[mysqld]的段中加上一句:skip-grant-tables ,保存并退出。
2.重启mysql。
3.登录并修改密码。
4.把mysql配置更改回来。去掉skip-grant-tables。
vim /etc/my.cnf #例如: datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock skip-grant-tables
2.重启mysql。
service mysqld restart #重启mysql 版本不同重启的方式不一样
3.登录并修改密码。
[root@iZ2866kru0eZ ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.32 MySQL Community Server (GPL) Copyright (c) 2000, 2016, 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. mysql> use mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ; Query OK, 0 rows affected (0.00 sec) Rows matched: 2 Changed: 0 Warnings: 0 mysql> flush privileges ; Query OK, 0 rows affected (0.01 sec) mysql> quit Bye
4.把mysql配置更改回来。去掉skip-grant-tables。
相关文章推荐
- windows下解决mysql密码更改问题
- 【小平工作日志】ubuntu14.04-16.04 eclipse安装svn插件 遇到的问题 Failed to load JavaHL Library.
- mysql更改密码后,无法登陆的问题
- MySQL复制中启动从库,日志中提示用户名及密码问题
- 2017年3月16工作日志【mysql更改字段参数、java8 map()调用方法示例】
- ubuntu下mysql安装路径更改及密码修改及日志文件
- 【小平工作日志】Mysql 相关sql语句(新建、更新等)持续更新中……
- mysql访问日志满造成linux磁盘空间不足问题系列跟踪解决
- 关于mysql的安装、配置及更改密码需注意的问题
- 关于两个问题:日志的自动备份脚本、mysql重置密码
- windows平台下 wampserver(php集成环境)修改Mysql密码的问题及wampserver更改默认web根目录
- 【小平工作日志】mysql索引总结、含 义
- MYSQL密码找回
- 更改mysql自带root用户密码
- [MySQL FAQ]系列 -- 写给新手:学会找到问题所在
- Exchange服务器系列课程之九--OWA更改密码
- MySQL密码丢失的找回方法(win/*inx)
- MySql学习笔记(登录、增加用户、密码更改)
- mysqlbinlog查看二进制日志的问题
- Exchange服务器系列课程之九--OWA更改密码