首页 > 技术文章 > 数据库的修改密码的操作

cnds168 2021-09-22 09:06 原文

1.破解数据库密码的操作:

第一步:停止mysql服务:service mysql stop

第二步:先将skip-grant-tables写到/etc/my.cnf

第三步:重启MYSQL服务:[root@localhost ~]# service mysqld restart

Redirecting to /bin/systemctl restart mysqld.service
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.报错
[root@localhost ~]#vim /var/log/mysqld.log 查看日志 找错误

修改/etc/my.cnf中的

validate_password_policy=0注释掉

validate_password_length=4注释掉

第四步:service  MYSQL restart 重启MYSQL服务

第五步:登录mysql:

mysql>  update mysql.user set authentication_string=password('centos') where user='root';修改root密码为centos

第六步:退出mysql注释/etc/my.cnf中的skip-grant-tables

第七步:重启mysql服务

ntpdate pool.ntp.org时间同步

 

推荐阅读