修改mysql主配置文件
vim /etc/my.cnf
[mysql]
skip-grant-tables
跳过密码认证
systemctl restart mysqld 重启mysql服务
mysql -uroot 指定用户登录
修改密码
update mysql.user set authentication_string=password('pwd123') where user='root';
退出去把跳过授权的删掉
重启服务
输入新密码即可
修改mysql主配置文件
vim /etc/my.cnf
[mysql]
skip-grant-tables
跳过密码认证
systemctl restart mysqld 重启mysql服务
mysql -uroot 指定用户登录
修改密码
update mysql.user set authentication_string=password('pwd123') where user='root';
退出去把跳过授权的删掉
重启服务
输入新密码即可