mysql5.7怎么重置密码

mysql5.7怎么重置密码,第1张

mysql5.7怎么重置密码

mysql5.7重置密码的方法:首先执行【update user set authentication_string = password('123456') where user = 'root';】语句;然后重启mysql服务即可。

具体方法:

(推荐教程:mysql视频教程)

关闭MySQL5.7的权限系统

找到MySQL5.7的配置文件my.cnf

在文件末尾编辑增加代码skip-grant-tables

重启mysqld服务,登陆MySQL

$systemctl restart mysqld

此时再登录mysql时,不需要密码就登录进去了。

修改root密码

$use mysql;
$select host,user,authentication_string from user;
#修改root密码
$update user set authentication_string = password('123456') where user = 'root';

开启权限系统,重启MySQL,新密码登录

$vim /etc/my.cnf
#开启权限系统
#skip-grant-tables
#重启mysql
$systemctl restart mysqld
#新root密码登陆
$mysql -uroot -p

相关推荐:mysql教程

以上就是mysql5.7怎么重置密码的详细内容,

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/703589.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-23
下一篇 2022-04-23

发表评论

登录后才能评论

评论列表(0条)

保存