New MySQL password reset

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.