mysql安装完成无法修改密码

mysql登录错误
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
无法修改密码
service mysqld stop
mysqld_safe --skip-grant-tables &
输入 mysql -uroot -p 回车进入
>use mysql;
> update user set password=PASSWORD("newpass")whereuser="root";
 更改密码为 newpassord
> flush privileges; 更新权限

grant all on *.* to 用户名@"%"identified by "密码";

flush privileges;
> quit 退出
service mysqld restart
mysql -uroot -p新密码进入


你可能感兴趣的:(mysql,修改密码)