您的位置:首页 > 博客中心 > 数据库 >

mysql密码问题

时间:2022-03-13 23:45

如果忘记root密码或其他用户密码,不要急,按下面操作即可。
1. 编辑mysql主配置文件 my.cnf
vim /etc/my.cnf  
在[mysqld]字段下添加参数  skip-grant  
2. 重启数据库服务
service mysqld restart
3. 这样就可以进入数据库不用授权了
mysql -uroot 
4. 修改相应用户密码
use mysql;
update user set password=password(‘your password‘) where user=‘root‘;
flush privileges;
5.  修改/etc/my.cnf 去掉 skip-grant , 重启mysql服务

本文出自 “” 博客,请务必保留此出处

热门排行

今日推荐

热门手游