Chinaunix首页 | 论坛 | 博客
  • 博客访问: 951126
  • 博文数量: 83
  • 博客积分: 32
  • 博客等级: 民兵
  • 技术积分: 2080
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-12 09:45
个人简介

努力学习,努力分享,努力.....在努力..努力离开..

文章分类

全部博文(83)

文章存档

2017年(3)

2015年(1)

2014年(47)

2013年(32)

分类: Mysql/postgreSQL

2013-10-27 11:31:31

(1)手工Kill掉MySQL进程
cat /mysql-data-directory/hostname.pid
kill 'hostname.pid'

(2)使用--skip-grant-tables重启MySQL
[root@localhost mysql]# ./bin/mysqld_safe --skip-grant-tables --user=test &
[root@localhost mysql]# Starting mysqld daemon with database from /home/test/mysql/data
--skip-grant-tables的意思是启动MySQL的时候不检测权限表认证

(3)再次连接MySQL修改ROOT密码
[root@localhost mysql]# mysql -uroot
mysql> set password = password('123123')
ERROR 1290(HY000):The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> update user set password=password('123123') where user='root' and host='localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
使用--skip-grant-tables启动MySQL不能使用set password修改密码直接update更改user表即可
mysql> flush privileges;
Query OK, 0 row affected (0.00 sec)

(4)重新用ROOT登录MySQL
[root@localhost mysql]# mysql -uroot -p123123
mysql>

阅读(845) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~