当前位置:Gxlcms > 数据库问题 > 新版mysql密码重置

新版mysql密码重置

时间:2021-07-01 10:21:17 帮助过:26人阅读

chmod 664 my.cnf #因为mysql的安全机制使得无权限的my.cnf失效,这里调高权限

 

service mysqld restart    #重启mysql服务

 

3、输入以下命令

 1 mysql -uroot -p
 2 
 3 #接着系统出现enter password,不用管,直接回车
 4 
 5 #下面使用mysql syntax直接修改密码
 6 #不要忘记语句末尾的分号
 7 
 8 use mysql;    #使用mysql数据库
 9 
10 select * from user;    #查看user表内所有数据
11 
12 #然后你会看见有一些列:Host、User、_priv等等,我们需要的是
13 #authentication_string和password_expired
14 
15 #更新密码,注意替换引号内的内容
16 update user set authentication_string=password(your password here) where user=your accountname e.g. root;
17 
18 #调整过期时间为No,不用重启后再次输入,注意替换
19 update user set password_expired=N where user=your accountname e.g. root; 

 

4、为了数据库安全,将my.cnf的‘skip-grant-tables’注释掉

 

5、重启mysql服务器

service mysqld restart

 

新版mysql密码重置

标签:nta   服务器   style   数据库   修改   password   enter   mysql服务器   ble   

人气教程排行