wmh1997

编辑my.cnf允许空密码登录

1 [root@7Core ~]# vi /etc/my.cnf
2 #在[mysqld]下加入一行
3 skip-grant-tables=1

重新启动Mysql服务

1 [root@7Core ~]# systemctl restart mysqld.service

使用Root登录数据库、使用mysql数据库、修改root密码、退出数据库

1 [root@7Core ~]# mysql -u root
2 mysql> use mysql;
3 mysql> update user set authentication_string = password(\'新密码\'),password_last_changed=now() where user=\'root\';
4 mysql> exit;

再次打开my.cnf,将skip-grant-tables=1删掉,保存退出

1 [root@7Core ~]# vi /etc/my.cnf
2 #删除skip-grant-tables=1

重启Mysql服务

1 [root@7Core ~]# systemctl restart mysqld.service

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2021-11-21
  • 2021-09-24
  • 2022-01-24
  • 2021-11-25
  • 2022-12-23
猜你喜欢
  • 2021-04-01
  • 2021-05-22
  • 2021-12-10
  • 2021-12-16
  • 2021-08-13
相关资源
相似解决方案