Reset MySQL password _ MySQL in Linux

Source: Internet
Author: User
Reset MySQL password bitsCN.com in Linux

Reset the MySQL password in Linux

According to relevant information, there are usually not many passwords that people can remember. many times, people use the same password for multiple accounts. However, the password of an account that is frequently accessed will not be forgotten. However, when you forget the MySQL password, the following describes how to forget the MySQL password in Linux. In fact, it is very simple. it only takes six steps to solve the problem. If you don't talk about it, go to the topic:

1. close the MySQL service:

Service mysqld stop

2. run the following command to exit the security mode. of course, this command is only valid when localhost is used.

/Usr/local/mysql/bin/mysqld_safe-skip-grant

3. enter MySQL

/Usr/local/mysql/bin/mysql-u root-p to enter mysql

4. change the password and execute the following statement:

Use mysql;

UPDATE user SET Password = password ("XXX") WHERE User = "root"; where xxx is the Password you want to SET

Flush privileges;

Exit;

5. remove skip-grant from the configuration file, modify the configuration file, set the configuration file to my. cnf in linux, set the configuration file to my. ini in windows, and add it under [mysqld ].

Skip-grant

6. start the MySQL service:

Service mysqld start

BitsCN.com

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.