Linux安装mysql出现1045,1130错误

MySql 解决方案:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

转载:https://www..com/article/4735331532/           

https://blog.****.net/weixin_36360036/article/details/81219617?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.edu_weight&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.edu_weight

登录mysql数据的时候:mysql -uroot -p

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

首先去编辑 vi /etc/my.cnf 在[mysqld]下找一行,加上skip-grant-tables跳过检验

然后重启mysql:service mysqld restart

再次登录mysql:mysql -uroot -p   (注意:不要输入密码,直接回车(Enter))

Linux安装mysql出现1045,1130错误

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';

出现提示:The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

mysql> flush privileges;

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码';

mysql> flush privileges;

mysql> quit

到这里就已经重置成新的密码成功了。

然后再去编辑 vi /etc/my.cnf 注解skip-grant-tables

Linux安装mysql出现1045,1130错误

最后重启mysql:service mysqld restart