Chinaunix首页 | 论坛 | 博客
  • 博客访问: 366834
  • 博文数量: 135
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1106
  • 用 户 组: 普通用户
  • 注册时间: 2013-03-20 09:56
文章分类

全部博文(135)

文章存档

2017年(3)

2016年(18)

2015年(69)

2014年(39)

2013年(6)

我的朋友

分类: Mysql/postgreSQL

2014-11-30 22:47:43

1.现场:

[root@ha02 ~]# mysqladmin -u root password 'root'

mysqladmin: connect to server at 'localhost' failed

error: 'Access denied for user 'root'@'localhost' (using password: NO)'

此时也无法修改密码

2.解决步骤

[root@ha02 ~]# service mysqld stop
 
Stopping mysqld:                                           [  OK  ]
 
[root@ha02 ~]# mysqld_safe --skip-grant-tables &
 
[1] 6249
 
[root@ha02 ~]# 141128 07:13:16 mysqld_safe Logging to '/var/log/mysqld.log'.
 
141128 07:13:16 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
 
[root@ha02 ~]# mysql -uroot -p
 
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.66 Source distribution
Copyright (c) 2000, 2012, 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("root")where user="root";
 
Query OK, 3 rows affected (0.00 sec)
 
Rows matched: 3  Changed: 3  Warnings: 0
 
  
 
mysql>  flush privileges;
 
Query OK, 0 rows affected (0.00 sec)
 
  
 
mysql> quit
 
Bye

阅读(1108) | 评论(0) | 转发(0) |
0

上一篇:python日志记录系统

下一篇:基本操作

给主人留下些什么吧!~~