转自http://stackoverflow.com/questions/9382219/error-1045-28000-access-denied-for-user-rootlocalhost-using-password-ye
- "mysql -u root"
- use mysql
- update user set authentication_string=password('yourpassword') where user='root';
- flush privileges;
另外的一个参考:http://jingyan.baidu.com/album/af9f5a2d16fa4d43150a4552.html?picindex=13