mysql 5.5安装 Unable to update security settings. Access denied for user 'root'@'localhost' (using password: YES)

windows下修复“mysql 5.5安装 Unable to update security settings. Access denied for user 'root'@'localhost' (using password: YES)


1,先关闭mysql


   window下在你的mysql安装目录下 例如c:\mysql2\bin\mysql-nt stop;


2,c:\mysql\bin\mysql-nt --skip-grant-tables


3,mysql -uroot


4,use mysql


5,update user set password = password('新密码') where user='root' and host='localhost'


6,flush privileges;


7,c:\mysql\bin\mysql-nt restart



linux下修复“mysql 5.5安装 Unable to update security settings. Access denied for user 'root'@'localhost' (using password: YES)”


关闭mysql


linux下的一般做法是
比如说mysql安装在/usr/local/mysql
 


/usr/local/mysql/bin/mysqld_safe --skip-grant-tables



这样启动后,你可以直接用mysql -uroot



登录进去之后



GRANT ALL PRIVILEGES on *.* to 'root'@'localhost' identified by '密码';