MySQL Database Password forgot Solution

Source: Internet
Author: User

The following articles mainly introduce the actual Solution to the Problem of forgetting the MySQL database password. If you encounter similar situations in actual operations, the following articles will be very useful to you and hope to help you in this aspect.

MySQL5.0 was installed a long time ago, and the passwords of the two MySQL databases were forgotten. I searched the internet and found the solution as follows:

I. Window

1. net stop MySQL Service

2. Run MySQLd-nt -- skip-grant-tables.

In this way, you can access MySQL without the MySQL database password.

3. Open a new command window, execute MySQL, and enter MySQL

4. Modify the root password

 
 
  1. use MySQL  
  2. update user set passwordpassword=password('NEW PASSWORD') where user='root';  
  3. flush privileges; 

5. kill the MySQLd-nt process in the task manager.

6. net start MySQL restart MySQL.

Ii. linux

1. killall-TERM MySQLd stops the MySQL Service

2. bin/safe_MySQLd -- skip-grant-tables &

In this way, you can access MySQL without the MySQL database password.

3. Run MySQL to enter MySQL

4. use MySQL

 
 
  1. update user set passwordpassword=password('NEW PASSWORD') where user='root';  
  2. flush privileges; 

5. killall-TERM MySQLd

6. bin/safe_MySQLd restart MySQL

The above content is an introduction to the solutions for forgetting the MySQL password. I hope you will find some gains.

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.