This tutorial is for password field invalidation for password reset.
Relatively simple, as follows:
1, Linux under the Change/etc/my.cnf "Windows location please Baidu" to find the [mysqld] field, the following plus
Skip-grant-tables
2. Exit save, enter in bash
CD/etc #打开my. cnf folder, Windows please replace chmod664 my.cnf # Because the security mechanism of MySQL makes the my.cnf invalid, the privilege is increased here
Service mysqld Restart #重启mysql服务
3. Enter the following command
1Mysql-uroot-P2 3 #接着系统出现enter Password, no tubes, direct carriage.4 5 #下面使用mysql Syntax Direct password change6 #不要忘记语句末尾的分号7 8 Use MySQL; #使用mysql数据库9 Ten Select*from user; #查看user表内所有数据 One A #然后你会看见有一些列: Host, User, _priv and so on, what we need is - #authentication_string和password_expired - the #更新密码, notice the substitution of the contents of the quotation marks -Update user Set Authentication_string=password ('Your password here') Where user='your accountname e.g. root'; - - #调整过期时间为No, do not re-enter after reboot, pay attention to replace +Update user Set password_expired='N'where user='your accountname e.g. root';
4, for the database security, the my.cnf ' Skip-grant-tables ' commented out
5. Restart the MySQL server
Service mysqld Restart
New MySQL password reset