本文介绍: 5.update mysql.user set authentication_string=PASSWORD(‘你的新密码‘) where USER=’root‘;7.再次vim /etc/my.cnf 删除添加skipgranttables保存退出。8.mysql -urootp‘你设置新密码进入到MySQL中需要再次重新设置密码。//可以和上面的密码重复。4.mysql -urootp 没有密码可以直接进入。2.进入#vim /etc/my.cnf。10.接下去就可以使用了。

1.先进入root模式

2.进入#vim /etc/my.cnf
在[mysqld]后面任意一行添加skipgranttables用来跳过密码验证过程保存退出

3.systemctl restart mysql#重启服务   或者    service mysqld restart#重启服务

4.mysql -urootp 没有密码可以直接进入

5.update mysql.user set authentication_string=PASSWORD(‘你的新密码‘) where USER=’root’;

6.flush privileges;#刷新权限

7.再次vim /etc/my.cnf 删除添加skipgranttables保存退出

8.mysql -uroot -p’你设置新密码‘进入到MySQL中需要再次重新设置密码

 set global validate_password_policy=0;set global validate_password_length=4;//可以修改MySQL密码策略使密码更简单

9.set password=password(“新密码“);//可以和上面的密码重复

10.接下去就可以使用了 

进入MySQL

use mysql

查询user

mysql> select user, host from user;

修改userHost内容修改%

mysql> update user set host=”%” where user=”root”;

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注