linux 里MySQL 数据库报 1045问题 解决方法
1、vim /etc/my.cnf 找到mysqld最下面空行,加入一行“skip-grant-tables” 保存退出 :wq
2、重启mysql服务 systemctl restart mysqld
3、输入mysql -uroot -p免密码进入mysql中
4、use mysql;
5、update user set authentication_string = PASSWORD('需要更换的新密码') where User = 'username';
6、FLUSH PRIVILEGES;
7、quit
8、输入mysql服务 service mysql restart 使用新的密码登录
9、vim /etc/my.cnf 找到mysqld最下面空行,将“skip-grant-tables” 注释掉,保存退出 :wq

浙公网安备 33010602011771号