Chinaunix首页 | 论坛 | 博客
  • 博客访问: 588300
  • 博文数量: 74
  • 博客积分: 1415
  • 博客等级: 中尉
  • 技术积分: 712
  • 用 户 组: 普通用户
  • 注册时间: 2011-07-21 16:37
文章分类

全部博文(74)

文章存档

2012年(31)

2011年(43)

分类: Mysql/postgreSQL

2011-08-16 15:10:37

First, you will need to make sure whether the default user is 'admin' or 'root' or whatever. You will then need to reset the password. 

Start the mysql server instance or daemon with the --skip-grant-tables option. (security setting) You can do it by adding the "skip-grant-tables" in the server section of /etc/my.cnf then restart mysql service by #service mysql restart 

Then Execute these statements. 
# mysql -u root mysql 
mysql> SELECT Host, User FROM mysql.user; 
+-------------------------------------------+------------------+ 
| Host | User | 
+-------------------------------------------+------------------+ 
| localhost | admin | 
|-------------------------------------------+------------------+ 
1 row in set (0.00 sec) 
mysql> UPDATE user SET Password=PASSWORD('your_new_password') where USER='The_user_@_localhost'; 
mysql> FLUSH PRIVILEGES; 
mysql> quit 
bye 

After that, restart the instance/daemon without the --skip-grant-tables option. (ie. modify the /etc/my.cnf AND # service mysql restart IF you follow the above) 

You should be able to connect with your new password. 

# mysql -u root -p OR # mysql -u admin -p 
Enter password: your_new_password 
阅读(1894) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~