织梦网站名称修改,建立网站准备工作,手机网站建设 广州,关键词排名怎样Mysql—修改用户密码#xff08;重置密码#xff09;
1、登录mysql 1 2 [rootlocalhost ~]# mysql -uroot -p123456 [rootlocalhost ~]# mysql -hlocalhost -uroot -p123456
如果忘记密码#xff0c;则跳过MySQL的密码认证过程。步骤如下#xff1a;
修改Mysql配置文件…Mysql—修改用户密码重置密码
1、登录mysql 1 2 [rootlocalhost ~]# mysql -uroot -p123456 [rootlocalhost ~]# mysql -hlocalhost -uroot -p123456
如果忘记密码则跳过MySQL的密码认证过程。步骤如下
修改Mysql配置文件vi /etc/my.cnf(注windows下修改的是my.ini)。在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程。重启Mysql进入Mysql[rootlocalhost ~]# mysql -uroot -p
2、使用mysql数据库从user表中查看主机用户名密码 1 2 3 4 5 6 7 8 -- 使用mysql数据库 mysql use mysql; -- 查询主机用户名密码5.7版本之前的 mysql select host,user,plugin,password from user; -- 查询主机用户名密码5.7版本之后的包括5.7 mysql select host,user,plugin,authentication_string from user; mysql select host,user,plugin,authentication_string from user\G; mysql select host,user,plugin,authentication_string from mysql.user;
3、修改密码刷新一下权限 1 2 3 mysql update user set passwordpassword(新密码) where userroot; mysql flush privileges; mysql quit
上面修改密码是在5.7版本之前的。若是5.7版本之后的包括5.7没有password这个字段了则修改方法如下 1 2 3 4 mysql alter user rootlocalhost identified by 新密码; --方法1 mysql update user set authentication_stringpassword(新密码) where userroot; -- 方法2 mysql flush privileges; mysql quit
4、如果以上不能解决密码修改则使用下面方法 1 2 3 mysql use mysql mysql alter user rootlocalhost identified with mysql_native_password by 新密码; mysql flush privileges;
修改加密规则mysql alter user rootlocalhost identified by password PASSWORD EXPIRE NEVER;
如果执行以上的操作并没有解决请再把default_authentication_pluginmysql_native_password添加到配置中。
5、再去编辑一下my.cnf配置文件去掉skip-grant-tables。
6、重启Mysql用你修改后的密码登录Mysql。