首页 > 代码库 > ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

解决:

(1)修改my.cnf中[mysqld]中增加skip-grant-tables

(2)重启mysql数据库:service mysqld restart

(3)无密码登录mysql中

(4)>use mysql;

(5)>update mysql.user set password=password(‘123456‘) where user= ‘root‘;

(6)> flush privileges;

(7)将my.cnf中增加的语句注释

(8)重启mysql数据库:service mysqld restart

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)