Chinaunix首页 | 论坛 | 博客
  • 博客访问: 152710
  • 博文数量: 42
  • 博客积分: 852
  • 博客等级: 准尉
  • 技术积分: 430
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-10 09:59
文章分类

全部博文(42)

文章存档

2015年(2)

2013年(9)

2012年(21)

2011年(4)

2009年(6)

我的朋友

分类: LINUX

2009-07-28 17:46:41

how to restore password of root for mysql

First things first. Log in as root and stop the mysql daemon. Now lets start up the mysql daemon and skip the grant tables which store the passwords.

1. killall mysqld

2. /usr/bin/mysqld_safe --skip-grant-tables       #(if  the mysql installed by rpm, )

You should see mysqld start up successfully. If not, well you have bigger issues. Now you should be able to connect to mysql without a password.

3.#mysql --user=root mysql

mysql>update user set Password=PASSWORD('aaa123') where user='root';
msyql>flush privileges;
msyql>exit;

Now kill your running mysqld, then restart it normally. You should be good to go. Try not to forget your password again.

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