报错:
[root@hadoop01 percona]# mysqladmin -u root password ‘root’
mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: NO)'
-
停止mysql的服务
[root@hadoop01 percona]# service mysql stop Shutting down MySQL.. SUCCESS!
-
安全模式进入mysql
[root@hadoop01 percona]# mysqld_safe --skip-grant-tables & [1] 13678
-
修改密码
mysql> use mysql;
mysql> update user set password=password('root') where user='root'and host='localhost';
mysql> flush privileges;
mysql> select * from user\G
mysql>quit
-
成功使用root密码进入mysql
service mysql start
mysql -uroot -proot