mysql: 1045 access denied for user 'root'@'localhost' using password yes

环境: win7 mysql 5.6

输入设定的密码错误,报错" 1045 access denied for user 'root'@'localhost' using password yes "

首先停止mysql

C:> mysql -u root mysql 
mysql> UPDATE user SET Password=PASSWORD(’新设密码newpassword’) where USER=’root’; 
mysql> FLUSH PRIVILEGES; 
mysql> quit 
C:> mysql -uroot -p 
Enter password: <输入新设的密码newpassword> 
mysql> 

另外一种方法,没机会试了

方法二: 
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码: 
# mysql -udebian-sys-maint -p 
Enter password: <输入[client]节的密码> 
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’; 
mysql> FLUSH PRIVILEGES; 
mysql> quit 
# mysql -uroot -p 
Enter password: <输入新设的密码newpassword> 
mysql> 

posted on 2013-11-23 21:50  影语者  阅读(585)  评论(0编辑  收藏  举报

导航